mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
decklinksink: Don't crash when going to READY another time
We have to handle the callback object a bit different: a) it needs a virtual destructor b) we need to set the callback to NULL when we're done with the output c) create a new one every time https://bugzilla.gnome.org/show_bug.cgi?id=740616
This commit is contained in:
parent
06013a0a6c
commit
2a0123d79a
2 changed files with 14 additions and 7 deletions
|
@ -179,9 +179,6 @@ gst_decklink_sink_init (GstDecklinkSink * decklinksink)
|
|||
decklinksink->mode = GST_DECKLINK_MODE_NTSC;
|
||||
decklinksink->device_number = 0;
|
||||
|
||||
decklinksink->callback = new Output;
|
||||
decklinksink->callback->decklinksink = decklinksink;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
g_mutex_init (&decklinksink->com_init_lock);
|
||||
g_mutex_init (&decklinksink->com_deinit_lock);
|
||||
|
@ -297,8 +294,6 @@ gst_decklink_sink_finalize (GObject * object)
|
|||
g_cond_clear (&decklinksink->audio_cond);
|
||||
g_mutex_clear (&decklinksink->audio_mutex);
|
||||
|
||||
delete decklinksink->callback;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* signal the COM thread that it should uninitialize COM */
|
||||
if (decklinksink->comInitialized) {
|
||||
|
@ -341,6 +336,9 @@ gst_decklink_sink_start (GstDecklinkSink * decklinksink)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
decklinksink->callback = new Output;
|
||||
decklinksink->callback->decklinksink = decklinksink;
|
||||
|
||||
decklinksink->output->SetAudioCallback (decklinksink->callback);
|
||||
|
||||
mode = gst_decklink_get_mode (decklinksink->mode);
|
||||
|
@ -353,8 +351,7 @@ gst_decklink_sink_start (GstDecklinkSink * decklinksink)
|
|||
}
|
||||
//decklinksink->video_enabled = TRUE;
|
||||
|
||||
decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->
|
||||
callback);
|
||||
decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->callback);
|
||||
|
||||
sample_depth = bmdAudioSampleType16bitInteger;
|
||||
ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
|
||||
|
@ -392,6 +389,11 @@ gst_decklink_sink_stop (GstDecklinkSink * decklinksink)
|
|||
decklinksink->output->DisableAudioOutput ();
|
||||
decklinksink->output->DisableVideoOutput ();
|
||||
|
||||
decklinksink->output->SetAudioCallback (NULL);
|
||||
decklinksink->output->SetScheduledFrameCompletionCallback (NULL);
|
||||
delete decklinksink->callback;
|
||||
decklinksink->callback = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -753,3 +755,6 @@ Output::RenderAudioSamples (bool preroll)
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Output::~Output() {
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public IDeckLinkAudioOutputCallback
|
|||
virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result);
|
||||
virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped ();
|
||||
virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples (bool preroll);
|
||||
|
||||
virtual ~Output();
|
||||
};
|
||||
|
||||
struct _GstDecklinkSink
|
||||
|
|
Loading…
Reference in a new issue