bug 1095251 shutdown GStreamer playbin during Shutdown() r=edwin

instead of during reader destruction.

--HG--
extra : rebase_source : b3abb13f88b4dfd0c7ab3b6183023b39824bf9b8
This commit is contained in:
Karl Tomlinson 2015-02-10 10:11:49 +13:00
Родитель 3ecf1f0bcf
Коммит 1891ba4549
2 изменённых файлов: 29 добавлений и 20 удалений

Просмотреть файл

@ -116,26 +116,7 @@ GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)
GStreamerReader::~GStreamerReader()
{
MOZ_COUNT_DTOR(GStreamerReader);
ResetDecode();
if (mPlayBin) {
gst_app_src_end_of_stream(mSource);
if (mSource)
gst_object_unref(mSource);
gst_element_set_state(mPlayBin, GST_STATE_NULL);
gst_object_unref(mPlayBin);
mPlayBin = nullptr;
mVideoSink = nullptr;
mVideoAppSink = nullptr;
mAudioSink = nullptr;
mAudioAppSink = nullptr;
gst_object_unref(mBus);
mBus = nullptr;
#if GST_VERSION_MAJOR >= 1
g_object_unref(mAllocator);
g_object_unref(mBufferPool);
#endif
}
NS_ASSERTION(!mPlayBin, "No Shutdown() after Init()");
}
nsresult GStreamerReader::Init(MediaDecoderReader* aCloneDonor)
@ -201,6 +182,33 @@ nsresult GStreamerReader::Init(MediaDecoderReader* aCloneDonor)
return NS_OK;
}
nsRefPtr<ShutdownPromise>
GStreamerReader::Shutdown()
{
ResetDecode();
if (mPlayBin) {
gst_app_src_end_of_stream(mSource);
if (mSource)
gst_object_unref(mSource);
gst_element_set_state(mPlayBin, GST_STATE_NULL);
gst_object_unref(mPlayBin);
mPlayBin = nullptr;
mVideoSink = nullptr;
mVideoAppSink = nullptr;
mAudioSink = nullptr;
mAudioAppSink = nullptr;
gst_object_unref(mBus);
mBus = nullptr;
#if GST_VERSION_MAJOR >= 1
g_object_unref(mAllocator);
g_object_unref(mBufferPool);
#endif
}
return MediaDecoderReader::Shutdown();
}
GstBusSyncReply
GStreamerReader::ErrorCb(GstBus *aBus, GstMessage *aMessage, gpointer aUserData)
{

Просмотреть файл

@ -44,6 +44,7 @@ public:
virtual ~GStreamerReader();
virtual nsresult Init(MediaDecoderReader* aCloneDonor) MOZ_OVERRIDE;
virtual nsRefPtr<ShutdownPromise> Shutdown() MOZ_OVERRIDE;
virtual nsresult ResetDecode() MOZ_OVERRIDE;
virtual bool DecodeAudioData() MOZ_OVERRIDE;
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,