[FFmpeg-cvslog] Reimplement stream probe try #2

Michael Niedermayer michaelni at gmx.at
Mon Apr 4 21:53:38 CEST 2011


On Mon, Apr 04, 2011 at 11:06:23AM -0700, Baptiste Coudurier wrote:
> On 4/3/11 9:20 AM, Michael Niedermayer wrote:
> > [...]
> >
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index 803acb3..71e8d73 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -704,10 +704,10 @@ static int mpegts_push_data(MpegTSFilter *filter,
> >                          code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */
> >                          code != 0x1f8) {                  /* ITU-T Rec. H.222.1 type E stream */
> >                          pes->state = MPEGTS_PESHEADER;
> > -                        if (pes->st->codec->codec_id == CODEC_ID_NONE) {
> > +                        if (!pes->st->request_probe) {
> >                              av_dlog(pes->stream, "pid=%x stream_type=%x probing\n",
> >                                      pes->pid, pes->stream_type);
> > -                            pes->st->codec->codec_id = CODEC_ID_PROBE;
> > +                            pes->st->request_probe= 1;
> >                          }
> 
> Humm, the check against CODEC_ID_NONE must not be changed, why was it ?

Its a bit complicated
The problems where mainly due to end detection
there are 3+ thresholds that can lead to stream probe abortion
the per stream packet buffer size, the per context bytes in the buffer
the end of the file as well as the end of the stream and possibly
more
Now probing before the end used a threshold to ignore uncertain
detections and only at the end the best independant of its score should
be choosen but this failed in at least some end scenarios.

so now codec_id is always set to the best codec found but we continue
probing until the thresholds hit or we have a good enough match.
The advantage is no matter how or where we end codec_id is set to
the best match, this though means it cant be set to CODEC_ID_PROBE.
which leads then to the need of request_probe


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20110404/5b395b25/attachment.asc>


More information about the ffmpeg-cvslog mailing list