[MPlayer-dev-eng] [PATCH] demux_ogg: Use double instead of float for pts.

Giorgio Vazzana mywing81 at gmail.com
Fri Dec 16 10:53:00 CET 2011


2011/12/15 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> On Thu, Dec 15, 2011 at 07:43:01PM +0100, Giorgio Vazzana wrote:
>> The attached patch #2 should solve the problem:
>
> Seems good, we should always have used double.
>
>> ps. sadly, this is not the only problem with live theora streams: when
>> the first packet of a stream has a granulepos=-1, MPlayer just sits
>> there waiting: this is because when a packet with a granulepos>=0
>> arrives, the pts goes from a very low value for the previous frame, to
>> a big value for the current frame, making the frametime several
>> minutes or even hours. I can provide a sample if someone wants to look
>> at it.
>
> Samples are good (whether someone will actually look at it is a
> different question I admit).

This sample shows the problem, with both -demuxer ogg and -demuxer lavf

http://mywing.altervista.org/tmp/c4.ogg

printed are the packets info from demux_ogg.c (as before, using patch
#1) and the pts of the current frame, next frame, and delta-pts
gathered using patch #3:

bytes=   16, data=0x249c670, granulepos=      -1             ,
packetno=4, lastpos=1, pts=0.100000
bytes= 1814, data=0x249c680, granulepos=      -1             ,
packetno=5, lastpos=2, pts=0.200000
    pts=0.100000, next_pts=0.200000, d=0.100000
bytes= 1052, data=0x249cd96, granulepos= 3840963=   60015|  3,
packetno=6, lastpos=60018, pts=6001.800000
    pts=0.200000, next_pts=6001.800000, d=6001.600000
bytes= 4507, data=0x249c670, granulepos= 3840964=   60015|  4,
packetno=7, lastpos=60019, pts=6001.900000
    pts=6001.800000, next_pts=6001.900000, d=0.100000

As you can see when going from packet 5 to 6 the pts goes from 0.2 to
6001.8, giving a delta-pts of
6001.6, which is why the MPlayer stops and wait. For now, I am
overriding this behaviour
by setting a constant framerate (after all, Ogg/Theora is constant
framerate, there is no
need to use pts to calculate frame times), waiting for a proper solution.

The other problem with demux_ogg, as far as I know, is the suboptimal
handling of 0-byte packets, which represent duplicate frames: the
packets are correctly read (with their pts) and added to the demux
system, but ds_get_next_pts() doesn't work with them and returns the
current frame pts, instead of the next frame (the 0-byte frame) pts,
giving a delta-pts=0. The net effect is that those frames are
basically discarded.

> But have you tried -demuxer lavf?
> It might be time to consider it as default again.

Yes, I have tried it. It has the same problems of demux_ogg.

> It is the default for on-disk files already, but I think there were
> some issues when streaming. You sound like you might be the right person
> to give it a rather thorough testing...

I don't know of any public theora live stream, apart from:

http://87.106.167.44:443/stream.ogg

I've been testing with my streams (ogg/theora stream source -> oggfwd
-> icecast),
and all the players I use (totem, vlc, ffplay) work well, these streams are even
supported out of the box on Firefox, mplayer seems the only one with issues.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003_video_fixed_framerate_theora.diff
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20111216/d0a33019/attachment-0001.bin>


More information about the MPlayer-dev-eng mailing list