aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-10-08 23:40:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-11-04 01:23:52 +0100
commitfeef77ec3a88baa830cfe71a17fe857339cc3ea3 (patch)
tree17bf88322e8bbe7cff1e10bf1efe453e3e084996
parentf531193690d91399dd99ae1bf61af311d9734f32 (diff)
downloadffmpeg-feef77ec3a88baa830cfe71a17fe857339cc3ea3.tar.gz
mpegts: fix return value when enough ts packets have been parsed or when the first PMT has been seen.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 49ec0c818dc3c1c293a582b57fb58ba611a10b32) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mpegts.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 82f422161e..da8f228426 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1083,7 +1083,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
// stop parsing after pmt, we found header
if (!ts->stream->nb_streams)
- ts->stop_parse = 1;
+ ts->stop_parse = 2;
for(;;) {
st = 0;
@@ -1403,11 +1403,15 @@ static int handle_packets(MpegTSContext *ts, int nb_packets)
ts->stop_parse = 0;
packet_num = 0;
for(;;) {
- if (ts->stop_parse>0)
- break;
packet_num++;
- if (nb_packets != 0 && packet_num >= nb_packets)
+ if (nb_packets != 0 && packet_num >= nb_packets ||
+ ts->stop_parse > 1) {
+ ret = AVERROR(EAGAIN);
break;
+ }
+ if (ts->stop_parse > 0)
+ break;
+
ret = read_packet(s, packet, ts->raw_packet_size);
if (ret != 0)
return ret;