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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4364>
This commit is contained in:
Seungha Yang 2023-04-07 22:13:24 +09:00 committed by GStreamer Marge Bot
parent 07cf7b2a29
commit 7117cba831

View file

@ -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);