mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-27 08:26:39 +00:00
oggdemux: don't loop when at EOS
When we try to read the last page, don't try to read past the upper boundary, as this might cause endless loops. See #582942
This commit is contained in:
parent
65c046b1ea
commit
ed36eafaba
1 changed files with 16 additions and 6 deletions
|
@ -1550,13 +1550,18 @@ gst_ogg_demux_seek (GstOggDemux * ogg, gint64 offset)
|
||||||
* the ogg sync layer.
|
* the ogg sync layer.
|
||||||
*/
|
*/
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_ogg_demux_get_data (GstOggDemux * ogg)
|
gst_ogg_demux_get_data (GstOggDemux * ogg, gint64 end_offset)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg, "get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
|
GST_LOG_OBJECT (ogg,
|
||||||
ogg->read_offset, ogg->length);
|
"get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
|
||||||
|
ogg->read_offset, ogg->length, end_offset);
|
||||||
|
|
||||||
|
if (end_offset > 0 && ogg->read_offset >= end_offset)
|
||||||
|
goto boundary_reached;
|
||||||
|
|
||||||
if (ogg->read_offset == ogg->length)
|
if (ogg->read_offset == ogg->length)
|
||||||
goto eos;
|
goto eos;
|
||||||
|
|
||||||
|
@ -1571,6 +1576,11 @@ gst_ogg_demux_get_data (GstOggDemux * ogg)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERROR */
|
/* ERROR */
|
||||||
|
boundary_reached:
|
||||||
|
{
|
||||||
|
GST_LOG_OBJECT (ogg, "reached boundary");
|
||||||
|
return GST_FLOW_LIMIT;
|
||||||
|
}
|
||||||
eos:
|
eos:
|
||||||
{
|
{
|
||||||
GST_LOG_OBJECT (ogg, "reached EOS");
|
GST_LOG_OBJECT (ogg, "reached EOS");
|
||||||
|
@ -1603,7 +1613,7 @@ static GstFlowReturn
|
||||||
gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary,
|
gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary,
|
||||||
gint64 * offset)
|
gint64 * offset)
|
||||||
{
|
{
|
||||||
gint64 end_offset = 0;
|
gint64 end_offset = -1;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg,
|
GST_LOG_OBJECT (ogg,
|
||||||
|
@ -1616,7 +1626,7 @@ gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary,
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
glong more;
|
glong more;
|
||||||
|
|
||||||
if (boundary > 0 && ogg->offset >= end_offset)
|
if (end_offset > 0 && ogg->offset >= end_offset)
|
||||||
goto boundary_reached;
|
goto boundary_reached;
|
||||||
|
|
||||||
more = ogg_sync_pageseek (&ogg->sync, og);
|
more = ogg_sync_pageseek (&ogg->sync, og);
|
||||||
|
@ -1634,7 +1644,7 @@ gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary,
|
||||||
goto boundary_reached;
|
goto boundary_reached;
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg, "need more data");
|
GST_LOG_OBJECT (ogg, "need more data");
|
||||||
ret = gst_ogg_demux_get_data (ogg);
|
ret = gst_ogg_demux_get_data (ogg, end_offset);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue