From 4834a292358860ef3f9737be6a886f8d621bc634 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski <85728496+stefankiesz@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:17:29 -0700 Subject: [PATCH 1/9] Add fix to kvsWebRTCClientMaster.c --- samples/kvsWebRTCClientMaster.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/samples/kvsWebRTCClientMaster.c b/samples/kvsWebRTCClientMaster.c index 52820eb496..c37e379903 100644 --- a/samples/kvsWebRTCClientMaster.c +++ b/samples/kvsWebRTCClientMaster.c @@ -169,6 +169,9 @@ PVOID sendVideoPackets(PVOID args) if (status != STATUS_SUCCESS) { DLOGV("writeFrame() failed with 0x%08x", status); } + } else { + // Reset file index to ensure first frame sent upon SRTP ready is a key frame. + fileIndex = 0; } } MUTEX_UNLOCK(pSampleConfiguration->streamingSessionListReadLock); @@ -232,6 +235,9 @@ PVOID sendAudioPackets(PVOID args) PROFILE_WITH_START_TIME(pSampleConfiguration->sampleStreamingSessionList[i]->offerReceiveTime, "Time to first frame"); pSampleConfiguration->sampleStreamingSessionList[i]->firstFrame = FALSE; } + } else { + // Reset file index to stay in sync with video frames. + fileIndex = 0; } } MUTEX_UNLOCK(pSampleConfiguration->streamingSessionListReadLock); From 955f0ade6fd6c199bda26fcfea2bacbba5445b42 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski Date: Fri, 20 Oct 2023 22:06:33 +0000 Subject: [PATCH 2/9] Change printf-s to DLOG-s --- samples/kvsWebrtcClientMasterGstSample.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index 8fe8f90b0d..fba1b1ee01 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -180,7 +180,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) pSampleConfiguration->rtspUri); if (stringOutcome > RTSP_PIPELINE_MAX_CHAR_COUNT) { - printf("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT\n"); + DLOGE("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT\n"); goto CleanUp; } pipeline = gst_parse_launch(rtspPipeLineBuffer, &error); @@ -226,7 +226,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) pSampleConfiguration->rtspUri); if (stringOutcome > RTSP_PIPELINE_MAX_CHAR_COUNT) { - printf("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT\n"); + DLOGE("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT\n"); goto CleanUp; } pipeline = gst_parse_launch(rtspPipeLineBuffer, &error); @@ -243,7 +243,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) appsinkAudio = gst_bin_get_by_name(GST_BIN(pipeline), "appsink-audio"); if (!(appsinkVideo != NULL || appsinkAudio != NULL)) { - printf("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x \n", + DLOGE("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x \n", STATUS_INTERNAL_ERROR); goto CleanUp; } @@ -438,8 +438,8 @@ INT32 main(INT32 argc, CHAR* argv[]) } else if (STRCMP(argv[3], "rtspsrc") == 0) { DLOGI("[KVS GStreamer Master] Using RTSP source in GStreamer"); if (argc < 5) { - printf("[KVS GStreamer Master] No RTSP source URI included. Defaulting to device source"); - printf("[KVS GStreamer Master] Usage: ./kvsWebrtcClientMasterGstSample audio-video rtspsrc rtsp://\n" + DLOGI("[KVS GStreamer Master] No RTSP source URI included. Defaulting to device source"); + DLOGI("[KVS GStreamer Master] Usage: ./kvsWebrtcClientMasterGstSample audio-video rtspsrc rtsp://\n" "or ./kvsWebrtcClientMasterGstSample video-only rtspsrc "); pSampleConfiguration->srcType = DEVICE_SOURCE; } else { @@ -450,7 +450,7 @@ INT32 main(INT32 argc, CHAR* argv[]) DLOGI("[KVS Gstreamer Master] Unrecognized source type. Defaulting to device source in GStreamer"); } } else { - printf("[KVS GStreamer Master] Using device source in GStreamer\n"); + DLOGI("[KVS GStreamer Master] Using device source in GStreamer\n"); } switch (pSampleConfiguration->mediaType) { From a76c867e23e8ab468fc755013d28f4de7a95de7b Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski Date: Fri, 20 Oct 2023 22:11:36 +0000 Subject: [PATCH 3/9] Add log for frame drop due to srtp not ready yet --- samples/kvsWebrtcClientMasterGstSample.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index fba1b1ee01..472eeca132 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -83,6 +83,8 @@ GstFlowReturn on_new_sample(GstElement* sink, gpointer data, UINT64 trackid) } else if (status == STATUS_SUCCESS && pSampleStreamingSession->firstFrame) { PROFILE_WITH_START_TIME(pSampleStreamingSession->offerReceiveTime, "Time to first frame"); pSampleStreamingSession->firstFrame = FALSE; + } else if (status == STATUS_SRTP_NOT_READY_YET) { + DLOGI("[KVS GStreamer Master] SRTP not ready yet, dropping frame") } } MUTEX_UNLOCK(pSampleConfiguration->streamingSessionListReadLock); From b3b083db7d2f9cd73e5c5df55702b4fcc5844223 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski Date: Fri, 20 Oct 2023 22:13:36 +0000 Subject: [PATCH 4/9] Add missing sample prefix to log lines --- samples/kvsWebrtcClientMasterGstSample.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index 472eeca132..4ba64eaaac 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -78,7 +78,7 @@ GstFlowReturn on_new_sample(GstElement* sink, gpointer data, UINT64 trackid) status = writeFrame(pRtcRtpTransceiver, &frame); if (status != STATUS_SRTP_NOT_READY_YET && status != STATUS_SUCCESS) { #ifdef VERBOSE - DLOGE("writeFrame() failed with 0x%08x", status); + DLOGE("[KVS GStreamer Master] writeFrame() failed with 0x%08x", status); #endif } else if (status == STATUS_SUCCESS && pSampleStreamingSession->firstFrame) { PROFILE_WITH_START_TIME(pSampleStreamingSession->offerReceiveTime, "Time to first frame"); @@ -283,7 +283,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) CleanUp: if (error != NULL) { - DLOGE("%s", error->message); + DLOGE("[KVS GStreamer Master] %s", error->message); g_clear_error(&error); } @@ -379,7 +379,7 @@ PVOID receiveGstreamerAudioVideo(PVOID args) CleanUp: if (error != NULL) { - DLOGE("%s", error->message); + DLOGE("[KVS GStreamer Master] %s", error->message); g_clear_error(&error); } From 6a3519c32ad996f060174a40966eb6448239a8a2 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski Date: Fri, 20 Oct 2023 22:14:27 +0000 Subject: [PATCH 5/9] Semicolon --- samples/kvsWebrtcClientMasterGstSample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index 4ba64eaaac..32d5a2200c 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -84,7 +84,7 @@ GstFlowReturn on_new_sample(GstElement* sink, gpointer data, UINT64 trackid) PROFILE_WITH_START_TIME(pSampleStreamingSession->offerReceiveTime, "Time to first frame"); pSampleStreamingSession->firstFrame = FALSE; } else if (status == STATUS_SRTP_NOT_READY_YET) { - DLOGI("[KVS GStreamer Master] SRTP not ready yet, dropping frame") + DLOGI("[KVS GStreamer Master] SRTP not ready yet, dropping frame"); } } MUTEX_UNLOCK(pSampleConfiguration->streamingSessionListReadLock); From 0c651ebb1395c3a4eebc82b972824a1473458570 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski <85728496+stefankiesz@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:58:57 -0700 Subject: [PATCH 6/9] CLANG --- samples/kvsWebrtcClientMasterGstSample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index 32d5a2200c..a05e0134a0 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -246,7 +246,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) if (!(appsinkVideo != NULL || appsinkAudio != NULL)) { DLOGE("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x \n", - STATUS_INTERNAL_ERROR); + STATUS_INTERNAL_ERROR); goto CleanUp; } @@ -442,7 +442,7 @@ INT32 main(INT32 argc, CHAR* argv[]) if (argc < 5) { DLOGI("[KVS GStreamer Master] No RTSP source URI included. Defaulting to device source"); DLOGI("[KVS GStreamer Master] Usage: ./kvsWebrtcClientMasterGstSample audio-video rtspsrc rtsp://\n" - "or ./kvsWebrtcClientMasterGstSample video-only rtspsrc "); + "or ./kvsWebrtcClientMasterGstSample video-only rtspsrc "); pSampleConfiguration->srcType = DEVICE_SOURCE; } else { pSampleConfiguration->srcType = RTSP_SOURCE; From 2548a19a8d2e7a50a758b10af24bd4d85d49ce13 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski <85728496+stefankiesz@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:07:42 -0700 Subject: [PATCH 7/9] Remove \n from logs --- samples/kvsWebrtcClientMasterGstSample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index a05e0134a0..e33c86b063 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -441,7 +441,7 @@ INT32 main(INT32 argc, CHAR* argv[]) DLOGI("[KVS GStreamer Master] Using RTSP source in GStreamer"); if (argc < 5) { DLOGI("[KVS GStreamer Master] No RTSP source URI included. Defaulting to device source"); - DLOGI("[KVS GStreamer Master] Usage: ./kvsWebrtcClientMasterGstSample audio-video rtspsrc rtsp://\n" + DLOGI("[KVS GStreamer Master] Usage: ./kvsWebrtcClientMasterGstSample audio-video rtspsrc rtsp://" "or ./kvsWebrtcClientMasterGstSample video-only rtspsrc "); pSampleConfiguration->srcType = DEVICE_SOURCE; } else { @@ -452,7 +452,7 @@ INT32 main(INT32 argc, CHAR* argv[]) DLOGI("[KVS Gstreamer Master] Unrecognized source type. Defaulting to device source in GStreamer"); } } else { - DLOGI("[KVS GStreamer Master] Using device source in GStreamer\n"); + DLOGI("[KVS GStreamer Master] Using device source in GStreamer"); } switch (pSampleConfiguration->mediaType) { From 877a60c83ee34123edcc74cb7b611bfedf9d2b4e Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski <85728496+stefankiesz@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:11:30 -0700 Subject: [PATCH 8/9] " " --- samples/kvsWebrtcClientMasterGstSample.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index e33c86b063..63c421f726 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -182,7 +182,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) pSampleConfiguration->rtspUri); if (stringOutcome > RTSP_PIPELINE_MAX_CHAR_COUNT) { - DLOGE("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT\n"); + DLOGE("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT"); goto CleanUp; } pipeline = gst_parse_launch(rtspPipeLineBuffer, &error); @@ -228,7 +228,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) pSampleConfiguration->rtspUri); if (stringOutcome > RTSP_PIPELINE_MAX_CHAR_COUNT) { - DLOGE("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT\n"); + DLOGE("[KVS GStreamer Master] ERROR: rtsp uri entered exceeds maximum allowed length set by RTSP_PIPELINE_MAX_CHAR_COUNT"); goto CleanUp; } pipeline = gst_parse_launch(rtspPipeLineBuffer, &error); @@ -245,7 +245,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) appsinkAudio = gst_bin_get_by_name(GST_BIN(pipeline), "appsink-audio"); if (!(appsinkVideo != NULL || appsinkAudio != NULL)) { - DLOGE("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x \n", + DLOGE("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x", STATUS_INTERNAL_ERROR); goto CleanUp; } From 394b1373602ef1a2f1d2a713a157aec089190113 Mon Sep 17 00:00:00 2001 From: Stefan Kieszkowski <85728496+stefankiesz@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:26:10 -0700 Subject: [PATCH 9/9] CLANG --- samples/kvsWebrtcClientMasterGstSample.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/kvsWebrtcClientMasterGstSample.c b/samples/kvsWebrtcClientMasterGstSample.c index 63c421f726..a031540dce 100644 --- a/samples/kvsWebrtcClientMasterGstSample.c +++ b/samples/kvsWebrtcClientMasterGstSample.c @@ -245,8 +245,7 @@ PVOID sendGstreamerAudioVideo(PVOID args) appsinkAudio = gst_bin_get_by_name(GST_BIN(pipeline), "appsink-audio"); if (!(appsinkVideo != NULL || appsinkAudio != NULL)) { - DLOGE("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x", - STATUS_INTERNAL_ERROR); + DLOGE("[KVS GStreamer Master] sendGstreamerAudioVideo(): cant find appsink, operation returned status code: 0x%08x", STATUS_INTERNAL_ERROR); goto CleanUp; }