[MPlayer-dev-eng] NUT dts proposal

Rich Felker dalias at aerifal.cx
Wed Sep 7 04:56:36 CEST 2005


On Wed, Sep 07, 2005 at 03:42:13AM +0200, Michael Niedermayer wrote:
> > Consequences:
> > 
> > Consider the typical IPB stream:
> > 
> > Muxed frame order:  I0 P3 B1 B2 P6 B4 B5 ...
> > Current dts system: -1  0  1  2  3  4  5
> > Possible new dts:    0  1  1  2  4  4  5
> > 
> > And the pathological IPB stream with huge gaps:
> > 
> > Muxed frame oder:   I0 P3 B1 B2 [gap] I100 P103 B101 B102
> > Current dts system: -1  0  1  2          3  100  101  102
> > Possible new dts:    0  1  1  2        100  101  101  102
> 
> hmm, why not weaken the interleaving rule and leave it to the muxer what to
> do exactly?

The goal of the interleaving rule was to make sure you don't need
nonsense "noninterleaved" demuxers like for avi, etc., and to make
sure you can find the frames you need after seeking without an index.

If you leave it entirely to the implementation and allow any random
muxing order, idiots _will_ make broken files that are difficult to
play without huge buffers or constant disk seeks. :(( However maybe
there's middle ground...

> one idea (warning its late&iam tired so it could be nonsense)
> is that packet[i].dts <= packet[j].pts when i<j 
> with the old dts definition

Well first sanity check, for decode_delay==0 on all streams this gives
perfect interleaving, which is a good sign. :) In addition, even with
decode_delay!=0 all frames with pts==dts are forced into perfect
pts-based interleaving.

At first glance it also seems to allow sane muxing order for arbitrary
streams. Actually deciding _how_ to make a good muxer to honor this
rule is maybe a little bit tricky, but I think both your original
dts-based muxing and the "mts"-based muxing satisfy the condition
quite obviously:

dts-based:
Suppose i<j. Then packet[i].dts <= packet[j].dts <= packet[j].pts.
(first by dts ordering, then by definition of dts)

mts-based:
Suppose i<j. Choose k>=i such that packet[i].mts == packet[k].pts (k
in same stream as i). Then:
    packet[i].dts <= packet[k].dts <= packet[k].pts
    == packet[i].mts <= packet[j].mts <= packet[j].pts.
(first by definition of dts and i/k in same stream, second by
definition of dts, third by choice of k, fourth by mts ordering, fifth
by definition of mts)

Conclusion: Michael is a very very smart man if he comes up with these
while half asleep like he claims. :) Errm wait he's a god not a man..
:))))

The remaining question is, should we leave this much flexibility? Or
should we do something to ensure that it's possible to find the right
frame after seeking? I'm inclined to think that, while satisfying the
above "MN condition"(tm), all frames should be muxed as close as
possible to their actual pts...

Rich







More information about the MPlayer-dev-eng mailing list