[gstreamer-bugs] [Bug 613995] New: weak decoders can error out in case data is provided them before PS
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Fri Mar 26 03:06:28 PDT 2010
https://bugzilla.gnome.org/show_bug.cgi?id=613995
GStreamer | gst-plugins-good | git
Summary: weak decoders can error out in case data is provided
them before PS
Classification: Desktop
Product: GStreamer
Version: git
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: gst-plugins-good
AssignedTo: gstreamer-bugs at lists.sourceforge.net
ReportedBy: marco.ballesio at nokia.com
QAContact: gstreamer-bugs at lists.sourceforge.net
GNOME target: ---
GNOME version: ---
Created an attachment (id=157147)
View: https://bugzilla.gnome.org/attachment.cgi?id=157147
Review: https://bugzilla.gnome.org/review?bug=613995&attachment=157147
patch
In case a weak decoder is connected to the depayloader, it may give an error
(or worst crash) in case depayloaded data is provided it before any NALU
containing parameter sets is sent.
Strictly speaking, the bug is in the decoder (and not in the depayloader) but
the attached patch will improve overall robustness and should introduce no
regressions (a normal H264 decoder cannot decode anything without having PSs).
>From 9866714aac7fed2974473854a43909be98fd68be Mon Sep 17 00:00:00 2001
From: Marco Ballesio <marco.ballesio at nokia.com>
Date: Wed, 17 Mar 2010 09:49:00 +0200
Subject: [PATCH] rtph264depay: drop buffers until the first Parameter Set is
received.
This way a weak decoder will not error out if fed with data for which it has
not been initialized. It will introduce no regressions as in theory no h264
decoder should be able to decode raw payload for which it didn't get
parameters.
---
gst/rtp/gstrtph264depay.c | 20 ++++++++++++++++++++
gst/rtp/gstrtph264depay.h | 2 ++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c
index f801b98..fc671c0 100644
--- a/gst/rtp/gstrtph264depay.c
+++ b/gst/rtp/gstrtph264depay.c
@@ -435,6 +435,26 @@ gst_rtp_h264_depay_push_nal (GstRtpH264Depay *
rtph264depay, GstBuffer * nal,
rtph264depay->last_ts = timestamp;
gst_adapter_push (rtph264depay->picture_adapter, nal);
+ /* Do not push anything if no parameter set has been received.
+ This adds robustness in case of weak decoders.*/
+ if(outbuf != NULL){
+ int type;
+
+ if(rtph264depay->byte_stream)
+ type = GST_BUFFER_DATA(outbuf)[4] & 0x1f;
+ else
+ type = GST_BUFFER_DATA(outbuf)[0] & 0x1f;
+
+ if(type == 7 || type == 8)
+ rtph264depay->ps_recv = TRUE;
+
+ if (!rtph264depay->ps_recv){
+ GST_DEBUG_OBJECT (rtph264depay, "got no ps, dropping buffer\n");
+ gst_buffer_unref(outbuf);
+ outbuf = NULL;
+ }
+ }
+
return outbuf;
}
diff --git a/gst/rtp/gstrtph264depay.h b/gst/rtp/gstrtph264depay.h
index 838dbd9..d17fbc0 100644
--- a/gst/rtp/gstrtph264depay.h
+++ b/gst/rtp/gstrtph264depay.h
@@ -54,6 +54,8 @@ struct _GstRtpH264Depay
GstAdapter *picture_adapter;
gboolean picture_start;
gboolean picture_complete;
+
+ gboolean ps_recv;
GstClockTime last_ts;
};
--
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the Gstreamer-bugs
mailing list