mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-29 10:38:27 +00:00
Differentiate between "no more data" from "IO failure" when reading.
Where no more data is available, av_read_frame just returns an error code instead of making the difference between "I am not returning anything because we finished reading" and "I am not returning anything because the underlying read failed". We differentiate between the two by looking at whether we outputted any data previously or not.
This commit is contained in:
parent
965f23f4f1
commit
89c3c79d5e
1 changed files with 22 additions and 1 deletions
|
@ -387,6 +387,7 @@ gst_ffmpegdemux_is_eos (GstFFMpegDemux * demux)
|
|||
|
||||
for (n = 0; n < MAX_STREAMS; n++) {
|
||||
if ((s = demux->streams[n])) {
|
||||
GST_DEBUG ("stream %d %p eos:%d", n, s, s->eos);
|
||||
if (!s->eos)
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -394,6 +395,22 @@ gst_ffmpegdemux_is_eos (GstFFMpegDemux * demux)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Returns True if we at least outputted one buffer */
|
||||
static gboolean
|
||||
gst_ffmpegdemux_has_outputted (GstFFMpegDemux * demux)
|
||||
{
|
||||
GstFFStream *s;
|
||||
gint n;
|
||||
|
||||
for (n = 0; n < MAX_STREAMS; n++) {
|
||||
if ((s = demux->streams[n])) {
|
||||
if (GST_CLOCK_TIME_IS_VALID (s->last_ts))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_ffmpegdemux_do_seek (GstFFMpegDemux * demux, GstSegment * segment)
|
||||
{
|
||||
|
@ -1446,7 +1463,11 @@ read_failed:
|
|||
/* pause appropriatly based on if we are flushing or not */
|
||||
if (demux->flushing)
|
||||
ret = GST_FLOW_WRONG_STATE;
|
||||
else
|
||||
else if (gst_ffmpegdemux_has_outputted (demux)
|
||||
|| gst_ffmpegdemux_is_eos (demux)) {
|
||||
GST_DEBUG_OBJECT (demux, "We are EOS");
|
||||
ret = GST_FLOW_UNEXPECTED;
|
||||
} else
|
||||
ret = GST_FLOW_ERROR;
|
||||
GST_OBJECT_UNLOCK (demux);
|
||||
|
||||
|
|
Loading…
Reference in a new issue