[FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

Michael Niedermayer michael at niedermayer.cc
Wed Oct 19 06:29:23 EEST 2016


On Tue, Oct 18, 2016 at 11:26:24PM +0200, Andreas Cadhalpun wrote:
> On 18.10.2016 22:56, Michael Niedermayer wrote:
> > On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote:
> >> Nothing guarantees to set request_probe to -1, so this assert can be
> >> triggered, e.g. if st->probe_packets is 0.
> > 
> > probe_codec() called with NULL should cause
> > st->probe_packets = 0
> > st->request_probe = -1;
> 
> Yes, but request_probe can be change to a different value later on,
> e.g. in ff_parse_mpeg2_descriptor:
> 
> int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
> {
> [...]
>             if (s->internal->raw_packet_buffer_remaining_size <= 0)
>                 if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 0, request_probe = -1
>                     return err;
> [...]
>         ret = s->iformat->read_packet(s, pkt);
> ~~~
> ff_parse_mpeg2_descriptor([...])
> {
> [...]
>     switch (desc_tag) {
> [...]
>     case 0x05: /* registration descriptor */
> [...]
>                 st->request_probe = 50;
> [...]
> }
> ~~~
> [...]
>                 if (st->probe_packets) // still 0
>                     if ((err = probe_codec(s, st, NULL)) < 0)
>                         return err;
>                 av_assert0(st->request_probe <= 0); // now 50
> SIGABRT

hmm, i guess the patch is then ok
alternatively you could use i think:
@@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
                 return ret;
             for (i = 0; i < s->nb_streams; i++) {
                 st = s->streams[i];
-                if (st->probe_packets)
+                if (st->probe_packets || st->request_probe > 0)
                     if ((err = probe_codec(s, st, NULL)) < 0)
                         return err;
                 av_assert0(st->request_probe <= 0);


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161019/3e76d936/attachment.sig>


More information about the ffmpeg-devel mailing list