From 7117cba83197d757955d519e6712d6571c93bce8 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 7 Apr 2023 22:13:24 +0900 Subject: [PATCH] decklinkaudiosink: Fix playback when video caps is configured before audio Scheduled playback starts on videosink's state change or on caps but it's possible that audiosink is configure without caps yet. Try start scheduled playback on audiosink's caps event as well Part-of: --- .../gst-plugins-bad/sys/decklink/gstdecklinkaudiosink.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkaudiosink.cpp b/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkaudiosink.cpp index b82f63d09a..67e3a9ef93 100644 --- a/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkaudiosink.cpp +++ b/subprojects/gst-plugins-bad/sys/decklink/gstdecklinkaudiosink.cpp @@ -332,9 +332,11 @@ gst_decklink_audio_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) sample_depth = bmdAudioSampleType32bitInteger; } + g_mutex_lock (&self->output->lock); ret = self->output->output->EnableAudioOutput (bmdAudioSampleRate48kHz, sample_depth, info.channels, bmdAudioOutputStreamContinuous); if (ret != S_OK) { + g_mutex_unlock (&self->output->lock); GST_WARNING_OBJECT (self, "Failed to enable audio output 0x%08lx", (unsigned long) ret); return FALSE; @@ -343,6 +345,10 @@ gst_decklink_audio_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) self->output->audio_enabled = TRUE; self->info = info; + if (self->output->start_scheduled_playback && self->output->videosink) + self->output->start_scheduled_playback (self->output->videosink); + g_mutex_unlock (&self->output->lock); + // Create a new resampler as needed if (self->resampler) gst_audio_resampler_free (self->resampler);