2011/6/29 Jindřich Makovička <[email protected]>:
>> http://www.datafilehost.com/download-16ab1765.html
>> http://www.datafilehost.com/download-af0b2237.html
>
> Actually, already read_packet() returns corrupted data for some
> reason. When I dumped the raw data, the continuity errors were there.
Oops, disregard that. The problem is the cc check ignores the payload
indicator. On packets w/o payload, CC is not incremented.
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index f2ae567..748d3d4 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1247,7 +1248,7 @@ static int handle_packet(MpegTSContext *ts,
const uint8_t *packet)
{
AVFormatContext *s = ts->stream;
MpegTSFilter *tss;
- int len, pid, cc, cc_ok, afc, is_start;
+ int len, pid, cc, next_cc, cc_ok, afc, is_start;
const uint8_t *p, *p_end;
int64_t pos;
@@ -1265,7 +1266,8 @@ static int handle_packet(MpegTSContext *ts,
const uint8_t *packet)
/* continuity check (currently not used) */
cc = (packet[3] & 0xf);
- cc_ok = (tss->last_cc < 0) || ((((tss->last_cc + 1) & 0x0f) == cc));
+ next_cc = (packet[3] & 0x10) ? (tss->last_cc + 1) & 0x0f : tss->last_cc;
+ cc_ok = (tss->last_cc < 0) || (next_cc == cc);
tss->last_cc = cc;
/* skip adaptation field */
--
Jindrich Makovicka
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel