Skip to content

Commit

Permalink
(a12) unbreak regular shmif client forwarding
Browse files Browse the repository at this point in the history
The directory work regressed some other parts thanks to a previously
omitted state transition in shmif-server (NOT_READY vs IDLE). The
a12cl-shmifsrv setup for forwarding a shmif client would just keep
producing video frames without synching to the encoder thread as
it expected NOT_READY as a signal for pause, instead of both that
and IDLE.
  • Loading branch information
letoram committed Oct 7, 2023
1 parent 07baa1f commit 6d0bd6c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/a12/a12.c
Expand Up @@ -388,11 +388,8 @@ void a12int_append_out(struct a12_state* S, uint8_t type,

static void reset_state(struct a12_state* S)
{
/* the 'reset' from an erroneous state is basically disconnect, just right
* now it finishes and let validation failures etc. handle that particular
* scenario */
S->left = header_sizes[STATE_NOPACKET];
if (S->state != STATE_1STSRV_PACKET)
if (S->state != STATE_1STSRV_PACKET && S->state != STATE_BROKEN)
S->state = STATE_NOPACKET;
S->decode_pos = 0;
S->in_channel = -1;
Expand Down Expand Up @@ -1675,6 +1672,11 @@ static void process_hello_auth(struct a12_state* S)
a12int_trace(A12_TRACE_SYSTEM, "kind=match:local=sink:remote=source");
S->remote_mode = ROLE_SOURCE;
}
else if (S->opts->local_role == ROLE_SINK && S->decode[54] == ROLE_SINK){
a12int_trace(A12_TRACE_SYSTEM, "kind=mismatch:local=sink:remote=sink");
fail_state(S);
return;
}
/* client: we might just be probing, if so continue without matching */
else if (S->opts->local_role == ROLE_PROBE){
}
Expand Down
4 changes: 3 additions & 1 deletion src/a12/net/a12_helper_srv.c
Expand Up @@ -518,7 +518,9 @@ static void* client_thread(void* inarg)
}

int pv;
while ((pv = shmifsrv_poll(data->C)) != CLIENT_NOT_READY){
while (
(pv = shmifsrv_poll(data->C)) != CLIENT_NOT_READY &&
pv != CLIENT_IDLE){
/* Dead client, send the close message and that should cascade down the rest
* and kill relevant sockets. */
if (pv == CLIENT_DEAD){
Expand Down
2 changes: 1 addition & 1 deletion src/a12/net/dir_cl.c
Expand Up @@ -709,7 +709,7 @@ static bool cl_got_dir(struct ioloop_shared* I, struct appl_meta* dir)
cbt->clopt->outapp.appl.name
);

/* this ignores die-on-list */
I->shutdown = true;
return true;
}

Expand Down

0 comments on commit 6d0bd6c

Please sign in to comment.