From 335f19f0e3404c2ec39f6f490da39523267dd8d4 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Thu, 3 Nov 2022 19:09:17 +0300 Subject: [PATCH] refactoring --- janus/src/client.c | 4 ++-- janus/src/plugin.c | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/janus/src/client.c b/janus/src/client.c index 6436a91..6ce9147 100644 --- a/janus/src/client.c +++ b/janus/src/client.c @@ -102,11 +102,11 @@ static void *_common_thread(void *v_client, bool video) { packet.video = rtp->video; packet.buffer = (char *)rtp->datagram; packet.length = rtp->used; -#if JANUS_PLUGIN_API_VERSION >= 100 +# if JANUS_PLUGIN_API_VERSION >= 100 // The uStreamer Janus plugin places video in stream index 0 and audio // (if available) in stream index 1. packet.mindex = (rtp->video ? 0 : 1); -#endif +# endif janus_plugin_rtp_extensions_reset(&packet.extensions); // FIXME: Это очень эффективный способ уменьшить задержку, но WebRTC стек в хроме и фоксе // слишком корявый, чтобы обработать это, из-за чего на кейфреймах начинаются заикания. diff --git a/janus/src/plugin.c b/janus/src/plugin.c index 91b0392..89840b2 100644 --- a/janus/src/plugin.c +++ b/janus/src/plugin.c @@ -440,14 +440,16 @@ static struct janus_plugin_result *_plugin_handle_message( "s=PiKVM uStreamer" RN "t=0 0" RN "%s%s", -#if JANUS_PLUGIN_API_VERSION >= 100 + us_get_now_id() >> 1, +# if JANUS_PLUGIN_API_VERSION >= 100 // Place video SDP before audio SDP so that the video and audio streams // have predictable indices, even if audio is not available. - us_get_now_id() >> 1, video_sdp, audio_sdp -#else + // See also client.c. + video_sdp, audio_sdp +# else // For versions of Janus prior to 1.x, place the audio SDP first. - us_get_now_id() >> 1, audio_sdp, video_sdp -#endif + audio_sdp, video_sdp +# endif ); free(audio_sdp); free(video_sdp);