Skip to content

Commit

Permalink
[rpm] Avoid crash in gst_video_frame_map_id. Fixes JB#37116
Browse files Browse the repository at this point in the history
For whatever reason, mVideoInfo sometimes is left uninitialized causing
gst_video_frame_map_id to die trying dereference mVideoInfo.finfo pointer.
  • Loading branch information
monich committed Dec 2, 2016
1 parent afaf4b4 commit aae3448
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions rpm/0003-Supply-source-uri-to-gstreamer-pipeline.patch
Expand Up @@ -130,10 +130,18 @@ index 8182f68..796a993 100644

for (size_t i = 0; i < sizeof(handles) / sizeof(handles[0]); i++) {
diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp
index 8940032..707427a 100644
index 8940032..105f68f 100644
--- a/dom/media/gstreamer/GStreamerReader.cpp
+++ b/dom/media/gstreamer/GStreamerReader.cpp
@@ -135,6 +135,11 @@ GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)
@@ -128,6 +128,7 @@ GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)
mSinkCallbacks.new_preroll = GStreamerReader::NewPrerollCb;
#if GST_VERSION_MAJOR >= 1
mSinkCallbacks.new_sample = GStreamerReader::NewBufferCb;
+ memset (&mVideoInfo, 0, sizeof (mVideoInfo));
#else
mSinkCallbacks.new_buffer = GStreamerReader::NewBufferCb;
mSinkCallbacks.new_buffer_list = nullptr;
@@ -135,6 +136,11 @@ GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)

gst_segment_init(&mVideoSegment, GST_FORMAT_UNDEFINED);
gst_segment_init(&mAudioSegment, GST_FORMAT_UNDEFINED);
Expand All @@ -145,7 +153,7 @@ index 8940032..707427a 100644
}

GStreamerReader::~GStreamerReader()
@@ -312,6 +317,51 @@ void GStreamerReader::PlayBinSourceSetupCb(GstElement* aPlayBin,
@@ -312,6 +318,51 @@ void GStreamerReader::PlayBinSourceSetupCb(GstElement* aPlayBin,
g_object_get(aPlayBin, "source", &source, nullptr);
reader->PlayBinSourceSetup(GST_APP_SRC(source));
}
Expand Down Expand Up @@ -197,7 +205,7 @@ index 8940032..707427a 100644

void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
{
@@ -344,6 +394,13 @@ void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
@@ -344,6 +395,13 @@ void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
gst_app_src_set_stream_type(mSource, GST_APP_STREAM_TYPE_SEEKABLE);
}

Expand All @@ -211,6 +219,15 @@ index 8940032..707427a 100644
// Set the source MIME type to stop typefind trying every. single. format.
GstCaps *caps =
GStreamerFormatHelper::ConvertFormatsToCaps(mDecoder->GetResource()->GetContentType().get(),
@@ -1492,7 +1550,7 @@ nsRefPtr<PlanarYCbCrImage> GStreamerReader::GetImageFromBuffer(GstBuffer* aBuffe
{
nsRefPtr<PlanarYCbCrImage> image = nullptr;

- if (gst_buffer_n_memory(aBuffer) == 1) {
+ if (gst_buffer_n_memory(aBuffer) == 1 && mVideoInfo.finfo) {
GstMemory* mem = gst_buffer_peek_memory(aBuffer, 0);
if (GST_IS_MOZ_GFX_MEMORY_ALLOCATOR(mem->allocator)) {
image = moz_gfx_memory_get_image(mem);
diff --git a/dom/media/gstreamer/GStreamerReader.h b/dom/media/gstreamer/GStreamerReader.h
index d455954..8746198c 100644
--- a/dom/media/gstreamer/GStreamerReader.h
Expand Down

0 comments on commit aae3448

Please sign in to comment.