diff mbox

[FFmpeg-devel,2/2] avcodec/utils: keep CORRUPT and TRUSTED packet flags when parsing packets

Message ID 20181009233214.8785-2-cus@passwd.hu
State New
Headers show

Commit Message

Marton Balint Oct. 9, 2018, 11:32 p.m. UTC
An FF_ macro got defined in avcodec.h to store the flags which need to be
propagated when parsers split packets so this won't be forgotten when a new
packet flag is introduced.

(I wonder if DISPOSABLE also fits here, or maybe some special handling is
needed like it is done for the keyframe flag?)
---
 libavcodec/avcodec.h             | 9 ++++++++-
 libavcodec/version.h             | 2 +-
 libavformat/utils.c              | 2 +-
 tests/ref/fate/flv-demux         | 2 +-
 tests/ref/fate/iv8-demux         | 2 +-
 tests/ref/fate/segment-mp4-to-ts | 6 +++---
 tests/ref/fate/ts-demux          | 2 +-
 7 files changed, 16 insertions(+), 9 deletions(-)

Comments

Michael Niedermayer Oct. 11, 2018, 10:50 a.m. UTC | #1
On Wed, Oct 10, 2018 at 01:32:14AM +0200, Marton Balint wrote:
> An FF_ macro got defined in avcodec.h to store the flags which need to be
> propagated when parsers split packets so this won't be forgotten when a new
> packet flag is introduced.
> 
> (I wonder if DISPOSABLE also fits here, or maybe some special handling is
> needed like it is done for the keyframe flag?)
> ---
>  libavcodec/avcodec.h             | 9 ++++++++-
>  libavcodec/version.h             | 2 +-
>  libavformat/utils.c              | 2 +-
>  tests/ref/fate/flv-demux         | 2 +-
>  tests/ref/fate/iv8-demux         | 2 +-
>  tests/ref/fate/segment-mp4-to-ts | 6 +++---
>  tests/ref/fate/ts-demux          | 2 +-
>  7 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 705a3ce4f3..9a3f9b6226 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1493,7 +1493,14 @@ typedef struct AVPacket {
>   * be discarded by the decoder.  I.e. Non-reference frames.
>   */
>  #define AV_PKT_FLAG_DISPOSABLE 0x0010
> -
> +/**
> + * Packet flags which must always be kept when parsers split packets
> + */
> +#define FF_PKT_FLAGS_KEEP_WHEN_PARSING (\
> +    AV_PKT_FLAG_CORRUPT | \
> +    AV_PKT_FLAG_DISCARD | \
> +    AV_PKT_FLAG_TRUSTED | \
> +    0)
>  
>  enum AVSideDataParamChangeFlags {
>      AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 97d134851f..79c5dc6773 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR  32
> -#define LIBAVCODEC_VERSION_MICRO 100
> +#define LIBAVCODEC_VERSION_MICRO 101
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index a8ac90213e..351bd88fa5 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -1511,7 +1511,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
>          out_pkt.pts          = st->parser->pts;
>          out_pkt.dts          = st->parser->dts;
>          out_pkt.pos          = st->parser->pos;
> -        out_pkt.flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
> +        out_pkt.flags       |= pkt->flags & FF_PKT_FLAGS_KEEP_WHEN_PARSING;

I think this is wrong
this looks like the packet flags are not passed through the parsers, so they would
not neccessarily be attached to the correct packets, there could be a delay
from a buffer ...

more so, these flags cannot be handled identically
for example if there is output packet formed from concatenating a trusted and 
untrusted input packet the output cannot be trusted because it is not just
trusted data

compared to corrupt, if there is output packet formed from concatenating a 
corrupt and non-corrupt input packet the output still is corrupt

It gets further complicated if only part of a AV_PKT_FLAG_CORRUPT input is
used. You cant mark the output as corrupt in this case because as documented
AV_PKT_FLAG_CORRUPT means the packet IS corrupt but a subpart of it may be
corrupt or may be undamaged.
A finer granularity of corruption likelyness would be needed here.
(checksums matching, probably ok - no checksums, possibly corrupt, 
 certainly some corrupt, certain significant corruption)
Independant of this there could be information about packet truncation.
a packet content could be known to be correct but possibly incomplete
All these cases differ in how they would have to be passed on when packets
are merged / split

[...]
Michael Niedermayer Oct. 11, 2018, 11:23 a.m. UTC | #2
On Thu, Oct 11, 2018 at 12:50:53PM +0200, Michael Niedermayer wrote:
> On Wed, Oct 10, 2018 at 01:32:14AM +0200, Marton Balint wrote:
> > An FF_ macro got defined in avcodec.h to store the flags which need to be
> > propagated when parsers split packets so this won't be forgotten when a new
> > packet flag is introduced.
> > 
> > (I wonder if DISPOSABLE also fits here, or maybe some special handling is
> > needed like it is done for the keyframe flag?)
> > ---
> >  libavcodec/avcodec.h             | 9 ++++++++-
> >  libavcodec/version.h             | 2 +-
> >  libavformat/utils.c              | 2 +-
> >  tests/ref/fate/flv-demux         | 2 +-
> >  tests/ref/fate/iv8-demux         | 2 +-
> >  tests/ref/fate/segment-mp4-to-ts | 6 +++---
> >  tests/ref/fate/ts-demux          | 2 +-
> >  7 files changed, 16 insertions(+), 9 deletions(-)
> > 
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 705a3ce4f3..9a3f9b6226 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -1493,7 +1493,14 @@ typedef struct AVPacket {
> >   * be discarded by the decoder.  I.e. Non-reference frames.
> >   */
> >  #define AV_PKT_FLAG_DISPOSABLE 0x0010
> > -
> > +/**
> > + * Packet flags which must always be kept when parsers split packets
> > + */
> > +#define FF_PKT_FLAGS_KEEP_WHEN_PARSING (\
> > +    AV_PKT_FLAG_CORRUPT | \
> > +    AV_PKT_FLAG_DISCARD | \
> > +    AV_PKT_FLAG_TRUSTED | \
> > +    0)
> >  
> >  enum AVSideDataParamChangeFlags {
> >      AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
> > diff --git a/libavcodec/version.h b/libavcodec/version.h
> > index 97d134851f..79c5dc6773 100644
> > --- a/libavcodec/version.h
> > +++ b/libavcodec/version.h
> > @@ -29,7 +29,7 @@
> >  
> >  #define LIBAVCODEC_VERSION_MAJOR  58
> >  #define LIBAVCODEC_VERSION_MINOR  32
> > -#define LIBAVCODEC_VERSION_MICRO 100
> > +#define LIBAVCODEC_VERSION_MICRO 101
> >  
> >  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> >                                                 LIBAVCODEC_VERSION_MINOR, \
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index a8ac90213e..351bd88fa5 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -1511,7 +1511,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
> >          out_pkt.pts          = st->parser->pts;
> >          out_pkt.dts          = st->parser->dts;
> >          out_pkt.pos          = st->parser->pos;
> > -        out_pkt.flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
> > +        out_pkt.flags       |= pkt->flags & FF_PKT_FLAGS_KEEP_WHEN_PARSING;
> 
> I think this is wrong
> this looks like the packet flags are not passed through the parsers, so they would
> not neccessarily be attached to the correct packets, there could be a delay
> from a buffer ...
> 
> more so, these flags cannot be handled identically
> for example if there is output packet formed from concatenating a trusted and 
> untrusted input packet the output cannot be trusted because it is not just
> trusted data

btw, also consider 256 1 byte trusted packets, arbitrary combination of these
are not trusted, the order by which they are combined has to be trusted too


[...]
Marton Balint Oct. 11, 2018, 8:39 p.m. UTC | #3
On Thu, 11 Oct 2018, Michael Niedermayer wrote:

> On Wed, Oct 10, 2018 at 01:32:14AM +0200, Marton Balint wrote:
>> An FF_ macro got defined in avcodec.h to store the flags which need to be
>> propagated when parsers split packets so this won't be forgotten when a new
>> packet flag is introduced.
>>
>> (I wonder if DISPOSABLE also fits here, or maybe some special handling is
>> needed like it is done for the keyframe flag?)
>> ---
>>  libavcodec/avcodec.h             | 9 ++++++++-
>>  libavcodec/version.h             | 2 +-
>>  libavformat/utils.c              | 2 +-
>>  tests/ref/fate/flv-demux         | 2 +-
>>  tests/ref/fate/iv8-demux         | 2 +-
>>  tests/ref/fate/segment-mp4-to-ts | 6 +++---
>>  tests/ref/fate/ts-demux          | 2 +-
>>  7 files changed, 16 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 705a3ce4f3..9a3f9b6226 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -1493,7 +1493,14 @@ typedef struct AVPacket {
>>   * be discarded by the decoder.  I.e. Non-reference frames.
>>   */
>>  #define AV_PKT_FLAG_DISPOSABLE 0x0010
>> -
>> +/**
>> + * Packet flags which must always be kept when parsers split packets
>> + */
>> +#define FF_PKT_FLAGS_KEEP_WHEN_PARSING (\
>> +    AV_PKT_FLAG_CORRUPT | \
>> +    AV_PKT_FLAG_DISCARD | \
>> +    AV_PKT_FLAG_TRUSTED | \
>> +    0)
>>
>>  enum AVSideDataParamChangeFlags {
>>      AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
>> diff --git a/libavcodec/version.h b/libavcodec/version.h
>> index 97d134851f..79c5dc6773 100644
>> --- a/libavcodec/version.h
>> +++ b/libavcodec/version.h
>> @@ -29,7 +29,7 @@
>>
>>  #define LIBAVCODEC_VERSION_MAJOR  58
>>  #define LIBAVCODEC_VERSION_MINOR  32
>> -#define LIBAVCODEC_VERSION_MICRO 100
>> +#define LIBAVCODEC_VERSION_MICRO 101
>>
>>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>>                                                 LIBAVCODEC_VERSION_MINOR, \
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index a8ac90213e..351bd88fa5 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -1511,7 +1511,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
>>          out_pkt.pts          = st->parser->pts;
>>          out_pkt.dts          = st->parser->dts;
>>          out_pkt.pos          = st->parser->pos;
>> -        out_pkt.flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
>> +        out_pkt.flags       |= pkt->flags & FF_PKT_FLAGS_KEEP_WHEN_PARSING;
>
> I think this is wrong
> this looks like the packet flags are not passed through the parsers, so they would
> not neccessarily be attached to the correct packets, there could be a delay
> from a buffer ...

True, this solution is not perfect, but probably better than what we have 
now, which is losing the corrupt flag entirely.

>
> more so, these flags cannot be handled identically
> for example if there is output packet formed from concatenating a trusted and
> untrusted input packet the output cannot be trusted because it is not just
> trusted data

OK, TRUSTED should be removed from the flags which are propagated.

>
> compared to corrupt, if there is output packet formed from concatenating a
> corrupt and non-corrupt input packet the output still is corrupt
>
> It gets further complicated if only part of a AV_PKT_FLAG_CORRUPT input is
> used. You cant mark the output as corrupt in this case because as documented
> AV_PKT_FLAG_CORRUPT means the packet IS corrupt but a subpart of it may be
> corrupt or may be undamaged.

IMHO there is no harm in setting corrupt flag if part of the (or the 
whole) packet comes from a corrupt source. Suspicion is enough. Losing the 
flag is a much bigger issue.

> A finer granularity of corruption likelyness would be needed here.
> (checksums matching, probably ok - no checksums, possibly corrupt,
> certainly some corrupt, certain significant corruption)
> Independant of this there could be information about packet truncation.
> a packet content could be known to be correct but possibly incomplete
> All these cases differ in how they would have to be passed on when packets
> are merged / split

Seems a bit of overdesign to me, a typical user app either bails out on 
error, or try decoding no matter how corrupted the input is, so not much 
point in signalling stuff between. That is also why I think that it is OK 
if we define AV_PKT_FLAG_CORRUPT as _suspected_ corruption, because it 
does not affect either use case.

Anyway, I still think setting the flag as it is done for 
AV_PKT_FLAG_DISCARD is better than ignoring it. Do you see a way to 
implement propagating the flag in a more sophisticated way with reasonable 
amount of work? On first look, the parser.c code seems pretty scary.

Regards,
Marton
Michael Niedermayer Oct. 11, 2018, 11:45 p.m. UTC | #4
On Thu, Oct 11, 2018 at 10:39:54PM +0200, Marton Balint wrote:
> 
> 
> On Thu, 11 Oct 2018, Michael Niedermayer wrote:
> 
> >On Wed, Oct 10, 2018 at 01:32:14AM +0200, Marton Balint wrote:
> >>An FF_ macro got defined in avcodec.h to store the flags which need to be
> >>propagated when parsers split packets so this won't be forgotten when a new
> >>packet flag is introduced.
> >>
> >>(I wonder if DISPOSABLE also fits here, or maybe some special handling is
> >>needed like it is done for the keyframe flag?)
> >>---
> >> libavcodec/avcodec.h             | 9 ++++++++-
> >> libavcodec/version.h             | 2 +-
> >> libavformat/utils.c              | 2 +-
> >> tests/ref/fate/flv-demux         | 2 +-
> >> tests/ref/fate/iv8-demux         | 2 +-
> >> tests/ref/fate/segment-mp4-to-ts | 6 +++---
> >> tests/ref/fate/ts-demux          | 2 +-
> >> 7 files changed, 16 insertions(+), 9 deletions(-)
> >>
> >>diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >>index 705a3ce4f3..9a3f9b6226 100644
> >>--- a/libavcodec/avcodec.h
> >>+++ b/libavcodec/avcodec.h
> >>@@ -1493,7 +1493,14 @@ typedef struct AVPacket {
> >>  * be discarded by the decoder.  I.e. Non-reference frames.
> >>  */
> >> #define AV_PKT_FLAG_DISPOSABLE 0x0010
> >>-
> >>+/**
> >>+ * Packet flags which must always be kept when parsers split packets
> >>+ */
> >>+#define FF_PKT_FLAGS_KEEP_WHEN_PARSING (\
> >>+    AV_PKT_FLAG_CORRUPT | \
> >>+    AV_PKT_FLAG_DISCARD | \
> >>+    AV_PKT_FLAG_TRUSTED | \
> >>+    0)
> >>
> >> enum AVSideDataParamChangeFlags {
> >>     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
> >>diff --git a/libavcodec/version.h b/libavcodec/version.h
> >>index 97d134851f..79c5dc6773 100644
> >>--- a/libavcodec/version.h
> >>+++ b/libavcodec/version.h
> >>@@ -29,7 +29,7 @@
> >>
> >> #define LIBAVCODEC_VERSION_MAJOR  58
> >> #define LIBAVCODEC_VERSION_MINOR  32
> >>-#define LIBAVCODEC_VERSION_MICRO 100
> >>+#define LIBAVCODEC_VERSION_MICRO 101
> >>
> >> #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> >>                                                LIBAVCODEC_VERSION_MINOR, \
> >>diff --git a/libavformat/utils.c b/libavformat/utils.c
> >>index a8ac90213e..351bd88fa5 100644
> >>--- a/libavformat/utils.c
> >>+++ b/libavformat/utils.c
> >>@@ -1511,7 +1511,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
> >>         out_pkt.pts          = st->parser->pts;
> >>         out_pkt.dts          = st->parser->dts;
> >>         out_pkt.pos          = st->parser->pos;
> >>-        out_pkt.flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
> >>+        out_pkt.flags       |= pkt->flags & FF_PKT_FLAGS_KEEP_WHEN_PARSING;
> >
> >I think this is wrong
> >this looks like the packet flags are not passed through the parsers, so they would
> >not neccessarily be attached to the correct packets, there could be a delay
> >from a buffer ...
> 
> True, this solution is not perfect, but probably better than what we have
> now, which is losing the corrupt flag entirely.
> 
> >
> >more so, these flags cannot be handled identically
> >for example if there is output packet formed from concatenating a trusted and
> >untrusted input packet the output cannot be trusted because it is not just
> >trusted data
> 
> OK, TRUSTED should be removed from the flags which are propagated.
> 
> >
> >compared to corrupt, if there is output packet formed from concatenating a
> >corrupt and non-corrupt input packet the output still is corrupt
> >
> >It gets further complicated if only part of a AV_PKT_FLAG_CORRUPT input is
> >used. You cant mark the output as corrupt in this case because as documented
> >AV_PKT_FLAG_CORRUPT means the packet IS corrupt but a subpart of it may be
> >corrupt or may be undamaged.
> 
> IMHO there is no harm in setting corrupt flag if part of the (or the whole)
> packet comes from a corrupt source. Suspicion is enough. Losing the flag is
> a much bigger issue.

ATM the documentation says "The packet content is corrupted"
If you want to set the flag when this is not true then the documentation
would need to be changed. Otherwise the code would violate the API
and the change of the documentation strictly speaking breaks API
and needs to be documented in APIChanges.
Yes iam quite aware that is taking things very strict and litteral here
but i think thats what we should aim for with APIs. The documentation
should be strictly correct or should make it clear when/where it is
not. 


> 
> >A finer granularity of corruption likelyness would be needed here.
> >(checksums matching, probably ok - no checksums, possibly corrupt,
> >certainly some corrupt, certain significant corruption)
> >Independant of this there could be information about packet truncation.
> >a packet content could be known to be correct but possibly incomplete
> >All these cases differ in how they would have to be passed on when packets
> >are merged / split
> 
> Seems a bit of overdesign to me, a typical user app either bails out on
> error, or try decoding no matter how corrupted the input is, so not much
> point in signalling stuff between. That is also why I think that it is OK if
> we define AV_PKT_FLAG_CORRUPT as _suspected_ corruption, because it does not
> affect either use case.

I think archival people would like to know exactly which parts of their
archive are corrupted


> 
> Anyway, I still think setting the flag as it is done for AV_PKT_FLAG_DISCARD
> is better than ignoring it. Do you see a way to implement propagating the
> flag in a more sophisticated way with reasonable amount of work? On first
> look, the parser.c code seems pretty scary.

Well, i dont have a magic bullet here. But for timestamps, file position
and keyframe flags we go to great lengths to keep them attached to the
correct packet. Why should we not do this for the flags ?

also  with the corrupt flag not only could the current code mark
undamaged parts of output packets as AV_PKT_FLAG_CORRUPT but also
the other way around.
If for example there are 5 input packets which comprise 1 output
packet, the corrupt flag would only be taken from one and so theres
a good chance a corrupt input would not be maked as corrupt on
output.


[...]
diff mbox

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 705a3ce4f3..9a3f9b6226 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1493,7 +1493,14 @@  typedef struct AVPacket {
  * be discarded by the decoder.  I.e. Non-reference frames.
  */
 #define AV_PKT_FLAG_DISPOSABLE 0x0010
-
+/**
+ * Packet flags which must always be kept when parsers split packets
+ */
+#define FF_PKT_FLAGS_KEEP_WHEN_PARSING (\
+    AV_PKT_FLAG_CORRUPT | \
+    AV_PKT_FLAG_DISCARD | \
+    AV_PKT_FLAG_TRUSTED | \
+    0)
 
 enum AVSideDataParamChangeFlags {
     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 97d134851f..79c5dc6773 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  32
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a8ac90213e..351bd88fa5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1511,7 +1511,7 @@  static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
         out_pkt.pts          = st->parser->pts;
         out_pkt.dts          = st->parser->dts;
         out_pkt.pos          = st->parser->pos;
-        out_pkt.flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
+        out_pkt.flags       |= pkt->flags & FF_PKT_FLAGS_KEEP_WHEN_PARSING;
 
         if (st->need_parsing == AVSTREAM_PARSE_FULL_RAW)
             out_pkt.pos = st->parser->frame_offset;
diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux
index 4a791754cb..0feac7a090 100644
--- a/tests/ref/fate/flv-demux
+++ b/tests/ref/fate/flv-demux
@@ -613,4 +613,4 @@ 
 0,      11612,      11612,       33,     1078, 0x501d1c72, F=0x0
 0,      11645,      11645,       33,     2600, 0xdf370d24, F=0x0
 1,      11656,      11656,       46,      346, 0x8899a188
-0,      11678,      11678,       33,     1190, 0xdc1e4c99, F=0x0
+0,      11678,      11678,       33,     1190, 0xdc1e4c99, F=0x2
diff --git a/tests/ref/fate/iv8-demux b/tests/ref/fate/iv8-demux
index 518f3de974..860a287d53 100644
--- a/tests/ref/fate/iv8-demux
+++ b/tests/ref/fate/iv8-demux
@@ -27,5 +27,5 @@ 
 0,      72000,      72000,        0,    20891, 0x3d064fd3
 0,      75600,      75600,        0,    20834, 0xcb774dbc
 0,      79200,      79200,        0,    20870, 0xbc536589
-0,      82800,      82800,        0,    21421, 0xc99a68e4
+0,      82800,      82800,        0,    21421, 0xc99a68e4, F=0x3
 0,      86400,      86400,        0,    12869, 0x5684e304
diff --git a/tests/ref/fate/segment-mp4-to-ts b/tests/ref/fate/segment-mp4-to-ts
index b5accb60f7..f54871b8a1 100644
--- a/tests/ref/fate/segment-mp4-to-ts
+++ b/tests/ref/fate/segment-mp4-to-ts
@@ -23,7 +23,7 @@ 
 0,      50400,      54000,        0,      607, 0xc53c2339, F=0x0, S=1,        1, 0x00e000e0
 0,      54000,      72000,        0,     4755, 0x2f642b58, F=0x0, S=1,        1, 0x00e000e0
 0,      57600,      64800,        0,     1182, 0xbe1a4847, F=0x0, S=1,        1, 0x00e000e0
-0,      61200,      61200,        0,      809, 0x8d948a4e, F=0x0, S=1,        1, 0x00e000e0
+0,      61200,      61200,        0,      809, 0x8d948a4e, F=0x2, S=1,        1, 0x00e000e0
 0,      64800,      68400,        0,      656, 0x4fa03c2b, F=0x0, S=1,        1, 0x00e000e0
 0,      68400,      86400,        0,    26555, 0x5629b584, S=1,        1, 0x00e000e0
 0,      72000,      79200,        0,     1141, 0x761b31e8, F=0x0, S=1,        1, 0x00e000e0
@@ -95,7 +95,7 @@ 
 0,     309600,     313200,     3600,      829, 0xffd795cd, F=0x0, S=1,        1, 0x00e000e0
 0,     313200,     331200,     3600,     5352, 0x59997996, F=0x0, S=1,        1, 0x00e000e0
 0,     316800,     324000,     3600,     1501, 0xb3b8f001, F=0x0, S=1,        1, 0x00e000e0
-0,     320400,     320400,     3600,      941, 0x92b0cb18, F=0x0, S=1,        1, 0x00e000e0
+0,     320400,     320400,     3600,      941, 0x92b0cb18, F=0x2, S=1,        1, 0x00e000e0
 0,     324000,     327600,     3600,      823, 0x3d548355, F=0x0, S=1,        1, 0x00e000e0
 0,     327600,     345600,     3600,    24042, 0x441e94fb, S=1,        1, 0x00e000e0
 0,     331200,     338400,     3600,     1582, 0x4f5d1049, F=0x0, S=1,        1, 0x00e000e0
@@ -119,7 +119,7 @@ 
 0,     396000,     399600,     3600,      199, 0x79b06355, F=0x0, S=1,        1, 0x00e000e0
 0,     399600,     417600,     3600,     1862, 0x22a2a06c, F=0x0, S=1,        1, 0x00e000e0
 0,     403200,     410400,     3600,      359, 0x11bdae52, F=0x0, S=1,        1, 0x00e000e0
-0,     406800,     406800,     3600,      235, 0xbec26964, F=0x0, S=1,        1, 0x00e000e0
+0,     406800,     406800,     3600,      235, 0xbec26964, F=0x2, S=1,        1, 0x00e000e0
 0,     410400,     414000,     3600,      221, 0x8380682c, F=0x0, S=1,        1, 0x00e000e0
 0,     414000,     432000,     3600,    22588, 0xf0ecf072, S=1,        1, 0x00e000e0
 0,     417600,     424800,     3600,      383, 0x4f3bb571, F=0x0, S=1,        1, 0x00e000e0
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index eb13ecc684..cc455118d6 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -13,7 +13,7 @@ 
 1,          0,          0,     2880,     1536, 0x773ffeea, S=1,        1, 0x00bd00bd
 1,       2880,       2880,     2880,     1536, 0x6dc10748
 1,       5760,       5760,     2880,     1536, 0xbab5129c
-1,       8640,       8640,     2880,     1536, 0x602f034b, S=1,        1, 0x00bd00bd
+1,       8640,       8640,     2880,     1536, 0x602f034b, F=0x3, S=1,        1, 0x00bd00bd
 1,      11520,      11520,     2880,      906, 0x69cdcbcd
 0,      32037,      36541,     1501,   114336, 0x37a215a8, S=1,        1, 0x00e000e0
 0,      33538,      33538,     1501,    12560, 0xb559a3d4, F=0x0, S=1,        1, 0x00e000e0