MT#56447 move "janus_session" to monologue

... so that the publishing session gets notified about "webrtcup" and
not the session which created the room.

Change-Id: If7b308df4afa7afb19ecaca1f743f87c3c736007
pull/1611/head
Richard Fuchs 3 years ago
parent 893dad702d
commit 7be1153acb

@ -3603,6 +3603,9 @@ static void __call_cleanup(struct call *c) {
media_player_put(&ml->player); media_player_put(&ml->player);
if (ml->tone_freqs) if (ml->tone_freqs)
g_array_free(ml->tone_freqs, true); g_array_free(ml->tone_freqs, true);
if (ml->janus_session)
obj_put_o((void *) ml->janus_session);
ml->janus_session = NULL;
} }
while (c->stream_fds.head) { while (c->stream_fds.head) {
@ -3612,10 +3615,6 @@ static void __call_cleanup(struct call *c) {
} }
recording_finish(c); recording_finish(c);
if (c->janus_session)
obj_put_o((void *) c->janus_session);
c->janus_session = NULL;
} }
/* called lock-free, but must hold a reference to the call */ /* called lock-free, but must hold a reference to the call */

@ -194,7 +194,6 @@ static const char *janus_videoroom_create(struct janus_session *session, struct
if (!call->created_from) if (!call->created_from)
call->created_from = "janus"; call->created_from = "janus";
g_hash_table_insert(janus_rooms, &room->id, room); g_hash_table_insert(janus_rooms, &room->id, room);
call->janus_session = obj_get(session);
rwlock_unlock_w(&call->master_lock); rwlock_unlock_w(&call->master_lock);
obj_put(call); obj_put(call);
break; break;
@ -524,6 +523,9 @@ static const char *janus_videoroom_join(struct websocket_message *wm, struct jan
else else
ret = sdp_create(jsep_sdp_out, dest_ml, &flags); ret = sdp_create(jsep_sdp_out, dest_ml, &flags);
if (!dest_ml->janus_session)
dest_ml->janus_session = obj_get(session);
if (ret) if (ret)
return "Error generating SDP"; return "Error generating SDP";
*jsep_type_out = "offer"; *jsep_type_out = "offer";
@ -723,6 +725,9 @@ static const char *janus_videoroom_configure(struct websocket_message *wm, struc
if (ret) if (ret)
return "Publish error"; return "Publish error";
if (!ml->janus_session)
ml->janus_session = obj_get(session);
save_last_sdp(ml, &sdp_in, &parsed, &streams); save_last_sdp(ml, &sdp_in, &parsed, &streams);
*jsep_sdp_out = sdp_out; *jsep_sdp_out = sdp_out;
sdp_out = STR_NULL; // ownership passed to output sdp_out = STR_NULL; // ownership passed to output
@ -1044,8 +1049,7 @@ void janus_detach_websocket(struct janus_session *session, struct websocket_conn
// call is locked in some way // call is locked in some way
void janus_media_up(struct call_monologue *ml) { void janus_media_up(struct call_monologue *ml) {
struct call *call = ml->call; struct janus_session *session = ml->janus_session;
struct janus_session *session = call->janus_session;
if (!session) if (!session)
return; return;

@ -506,6 +506,7 @@ struct call_monologue {
char *sdp_session_name; char *sdp_session_name;
struct ssrc_hash *ssrc_hash; struct ssrc_hash *ssrc_hash;
str metadata; str metadata;
struct janus_session *janus_session;
// DTMF blocking/replacement stuff: // DTMF blocking/replacement stuff:
enum block_dtmf_mode block_dtmf; enum block_dtmf_mode block_dtmf;
@ -633,7 +634,6 @@ struct call {
GQueue endpoint_maps; GQueue endpoint_maps;
struct dtls_cert *dtls_cert; /* for outgoing */ struct dtls_cert *dtls_cert; /* for outgoing */
struct mqtt_timer *mqtt_timer; struct mqtt_timer *mqtt_timer;
struct janus_session *janus_session;
str callid; str callid;
struct timeval created; struct timeval created;

Loading…
Cancel
Save