mpegtsbase: Fix pull mode scanning for PCR on small files

If a file does not contain 5 PCRs until it is EOS, or does not
contain more than 655360 bytes the PCR scanning algorithm just
aborted.
This commit is contained in:
Sebastian Dröge 2014-03-27 19:22:03 +01:00
parent f701755b83
commit 0cecb44813

View file

@ -1161,7 +1161,7 @@ mpegts_base_scan (MpegTSBase * base)
gboolean done = FALSE;
MpegTSPacketizerPacketReturn pret;
gint64 tmpval;
guint64 upstream_size, seek_pos;
gint64 upstream_size, seek_pos;
GstFormat format;
guint initial_pcr_seen;
@ -1172,8 +1172,12 @@ mpegts_base_scan (MpegTSBase * base)
GST_DEBUG ("Grabbing %d => %d", i * 65536, 65536);
ret = gst_pad_pull_range (base->sinkpad, i * 65536, 65536, &buf);
if (G_UNLIKELY (ret != GST_FLOW_OK))
if (G_UNLIKELY (ret == GST_FLOW_EOS)) {
done = TRUE;
break;
} else if (G_UNLIKELY (ret != GST_FLOW_OK)) {
goto beach;
}
/* Push to packetizer */
mpegts_packetizer_push (base->packetizer, buf);
@ -1221,8 +1225,12 @@ mpegts_base_scan (MpegTSBase * base)
GST_DEBUG ("Grabbing %" G_GUINT64_FORMAT " => %d", seek_pos, 65536);
ret = gst_pad_pull_range (base->sinkpad, seek_pos, 65536, &buf);
if (G_UNLIKELY (ret != GST_FLOW_OK))
if (G_UNLIKELY (ret == GST_FLOW_EOS)) {
done = TRUE;
break;
} else if (G_UNLIKELY (ret != GST_FLOW_OK)) {
goto beach;
}
/* Push to packetizer */
mpegts_packetizer_push (base->packetizer, buf);