mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gst/: Don't return FLOW_UNEXPECTED when a buffer is before the start of the stream (which might happen with large ID3...
Original commit message from CVS: * gst/apetag/gsttagdemux.c: (gst_tag_demux_trim_buffer), (gst_tag_demux_read_range): * gst/id3demux/gstid3demux.c: (gst_id3demux_trim_buffer), (gst_id3demux_read_range): Don't return FLOW_UNEXPECTED when a buffer is before the start of the stream (which might happen with large ID3v2 tags if the tag reading was done pullrange based and we then switched to push mode later on). Fixes regression introduced by commit from June 29th.
This commit is contained in:
parent
b22fbf9f20
commit
a516e84194
3 changed files with 55 additions and 12 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-07-05 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/apetag/gsttagdemux.c: (gst_tag_demux_trim_buffer),
|
||||
(gst_tag_demux_read_range):
|
||||
* gst/id3demux/gstid3demux.c: (gst_id3demux_trim_buffer),
|
||||
(gst_id3demux_read_range):
|
||||
Don't return FLOW_UNEXPECTED when a buffer is before
|
||||
the start of the stream (which might happen with
|
||||
large ID3v2 tags if the tag reading was done pullrange
|
||||
based and we then switched to push mode later on).
|
||||
Fixes regression introduced by commit from June 29th.
|
||||
|
||||
2006-07-05 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/taglib/gstid3v2mux.cc:
|
||||
|
|
|
@ -353,6 +353,10 @@ gst_tag_demux_remove_srcpad (GstTagDemux * demux)
|
|||
return res;
|
||||
};
|
||||
|
||||
/* will return FALSE if buffer is beyond end of data; will return TRUE
|
||||
* if buffer was trimmed successfully or didn't need trimming, but may
|
||||
* also return TRUE and set *buf_ref to NULL if the buffer was before
|
||||
* the start of the data */
|
||||
static gboolean
|
||||
gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
|
||||
{
|
||||
|
@ -377,7 +381,7 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
|
|||
|
||||
if (out_offset >= v1tag_offset) {
|
||||
GST_DEBUG_OBJECT (tagdemux, "Buffer is past the end of the data");
|
||||
goto no_out_buffer;
|
||||
goto no_out_buffer_end;
|
||||
}
|
||||
|
||||
if (out_offset + out_size > v1tag_offset) {
|
||||
|
@ -392,7 +396,7 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
|
|||
if (out_offset <= tagdemux->priv->strip_start) {
|
||||
if (out_offset + out_size <= tagdemux->priv->strip_start) {
|
||||
GST_DEBUG_OBJECT (tagdemux, "Buffer is before the start of the data");
|
||||
goto no_out_buffer;
|
||||
goto no_out_buffer_start;
|
||||
}
|
||||
|
||||
trim_start = tagdemux->priv->strip_start - out_offset;
|
||||
|
@ -431,10 +435,18 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
|
|||
|
||||
return TRUE;
|
||||
|
||||
no_out_buffer:
|
||||
gst_buffer_unref (buf);
|
||||
*buf_ref = NULL;
|
||||
return FALSE;
|
||||
no_out_buffer_end:
|
||||
{
|
||||
gst_buffer_unref (buf);
|
||||
*buf_ref = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
no_out_buffer_start:
|
||||
{
|
||||
gst_buffer_unref (buf);
|
||||
*buf_ref = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1171,6 +1183,9 @@ gst_tag_demux_read_range (GstTagDemux * demux,
|
|||
if (ret == GST_FLOW_OK && *buffer) {
|
||||
if (!gst_tag_demux_trim_buffer (demux, buffer))
|
||||
goto read_beyond_end;
|
||||
|
||||
/* this should only happen in streaming mode */
|
||||
g_assert (*buffer != NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -305,6 +305,10 @@ gst_id3demux_remove_srcpad (GstID3Demux * id3demux)
|
|||
return res;
|
||||
};
|
||||
|
||||
/* will return FALSE if buffer is beyond end of data; will return TRUE
|
||||
* if buffer was trimmed successfully or didn't need trimming, but may
|
||||
* also return TRUE and set *buf_ref to NULL if the buffer was before
|
||||
* the start of the data */
|
||||
static gboolean
|
||||
gst_id3demux_trim_buffer (GstID3Demux * id3demux, GstBuffer ** buf_ref)
|
||||
{
|
||||
|
@ -328,7 +332,7 @@ gst_id3demux_trim_buffer (GstID3Demux * id3demux, GstBuffer ** buf_ref)
|
|||
|
||||
if (out_offset >= v1tag_offset) {
|
||||
GST_DEBUG_OBJECT (id3demux, "Buffer is past the end of the data");
|
||||
goto no_out_buffer;
|
||||
goto no_out_buffer_end;
|
||||
}
|
||||
|
||||
if (out_offset + out_size > v1tag_offset) {
|
||||
|
@ -343,7 +347,7 @@ gst_id3demux_trim_buffer (GstID3Demux * id3demux, GstBuffer ** buf_ref)
|
|||
if (out_offset <= id3demux->strip_start) {
|
||||
if (out_offset + out_size <= id3demux->strip_start) {
|
||||
GST_DEBUG_OBJECT (id3demux, "Buffer is before the start of the data");
|
||||
goto no_out_buffer;
|
||||
goto no_out_buffer_start;
|
||||
}
|
||||
|
||||
trim_start = id3demux->strip_start - out_offset;
|
||||
|
@ -381,10 +385,19 @@ gst_id3demux_trim_buffer (GstID3Demux * id3demux, GstBuffer ** buf_ref)
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
no_out_buffer:
|
||||
gst_buffer_unref (buf);
|
||||
*buf_ref = NULL;
|
||||
return FALSE;
|
||||
|
||||
no_out_buffer_end:
|
||||
{
|
||||
gst_buffer_unref (buf);
|
||||
*buf_ref = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
no_out_buffer_start:
|
||||
{
|
||||
gst_buffer_unref (buf);
|
||||
*buf_ref = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -945,6 +958,9 @@ gst_id3demux_read_range (GstID3Demux * id3demux,
|
|||
if (ret == GST_FLOW_OK && *buffer) {
|
||||
if (!gst_id3demux_trim_buffer (id3demux, buffer))
|
||||
goto read_beyond_end;
|
||||
|
||||
/* this should only happen in streaming mode */
|
||||
g_assert (*buffer != NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue