janus: key_required handler

This commit is contained in:
Maxim Devaev
2022-11-04 13:51:49 +03:00
parent 22e5c8627b
commit 86a2141361

View File

@@ -154,9 +154,9 @@ static void *_video_sink_thread(UNUSED void *arg) {
if (frame == NULL) {
goto close_memsink;
}
// if (frame->key) {
// atomic_store(&_g_key_required, false);
// }
if (frame->key) {
atomic_store(&_g_key_required, false);
}
if (us_queue_put(_g_video_queue, frame, 0) != 0) {
_IF_NOT_REPORTED({ US_JLOG_PERROR("video", "Video queue is full"); });
us_frame_destroy(frame);
@@ -427,7 +427,6 @@ static struct janus_plugin_result *_plugin_handle_message(
} else if (!strcmp(request_str, "watch")) {
char *sdp;
{
// atomic_store(&_g_key_required, true);
char *const video_sdp = us_rtpv_make_sdp(_g_rtpv);
char *const audio_sdp = (_g_rtpa ? us_rtpa_make_sdp(_g_rtpa) : us_strdup(""));
US_ASPRINTF(sdp,
@@ -455,6 +454,10 @@ static struct janus_plugin_result *_plugin_handle_message(
PUSH_STATUS("started", offer_jsep);
json_decref(offer_jsep);
} else if (!strcmp(request_str, "key_required")) {
US_JLOG_INFO("main", "Got keyframe request from a client");
atomic_store(&_g_key_required, true);
} else {
PUSH_ERROR(405, "Not implemented");
}