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

Giorgio Vazzana mywing81 at gmail.com
Thu Dec 15 19:43:01 CET 2011


Hello,

in ogg/theora live streams the granulepos value can get pretty big
after some days of streaming, and the current code in demux_ogg.c uses
float values to calculate the pts: this can lead to an error where two
consecutive frames have the same pts. It can be shown by applying
patch #1 and playing the following file captured from a live stream
with wget:

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

mplayer -demuxer ogg -vc theora visionair.ogg -nosound -v
...
bytes= 5287, data=0x1cf6610, granulepos=1673180161=26143440|  1,
packetno=4, lastpos=26143441, pts=1742896.125000
bytes= 5377, data=0x1cf6610, granulepos=1673180162=26143440|  2,
packetno=5, lastpos=26143442, pts=1742896.125000
bytes= 5555, data=0x1cf6610, granulepos=1673180163=26143440|  3,
packetno=6, lastpos=26143443, pts=1742896.250000
bytes= 5733, data=0x1cf6610, granulepos=1673180164=26143440|  4,
packetno=7, lastpos=26143444, pts=1742896.250000
bytes= 5780, data=0x1cf6610, granulepos=1673180165=26143440|  5,
packetno=8, lastpos=26143445, pts=1742896.375000
bytes= 5825, data=0x1cf6610, granulepos=1673180166=26143440|  6,
packetno=9, lastpos=26143446, pts=1742896.375000
bytes= 5964, data=0x1cf6610, granulepos=1673180167=26143440|  7,
packetno=10, lastpos=26143447, pts=1742896.500000
bytes= 5961, data=0x1cf6610, granulepos=1673180168=26143440|  8,
packetno=11, lastpos=26143448, pts=1742896.500000
bytes= 6005, data=0x1cf6610, granulepos=1673180169=26143440|  9,
packetno=12, lastpos=26143449, pts=1742896.625000
bytes= 5923, data=0x1cf6610, granulepos=1673180170=26143440| 10,
packetno=13, lastpos=26143450, pts=1742896.625000

The attached patch #2 should solve the problem:

mplayer -demuxer ogg -vc theora visionair.ogg -nosound -v
...
bytes= 5287, data=0x23ef610, granulepos=1673180161=26143440|  1,
packetno=4, lastpos=26143441, pts=1742896.066667
bytes= 5377, data=0x23ef610, granulepos=1673180162=26143440|  2,
packetno=5, lastpos=26143442, pts=1742896.133333
bytes= 5555, data=0x23ef610, granulepos=1673180163=26143440|  3,
packetno=6, lastpos=26143443, pts=1742896.200000
bytes= 5733, data=0x23ef610, granulepos=1673180164=26143440|  4,
packetno=7, lastpos=26143444, pts=1742896.266667
bytes= 5780, data=0x23ef610, granulepos=1673180165=26143440|  5,
packetno=8, lastpos=26143445, pts=1742896.333333
bytes= 5825, data=0x23ef610, granulepos=1673180166=26143440|  6,
packetno=9, lastpos=26143446, pts=1742896.400000
bytes= 5964, data=0x23ef610, granulepos=1673180167=26143440|  7,
packetno=10, lastpos=26143447, pts=1742896.466667
bytes= 5961, data=0x23ef610, granulepos=1673180168=26143440|  8,
packetno=11, lastpos=26143448, pts=1742896.533333
bytes= 6005, data=0x23ef610, granulepos=1673180169=26143440|  9,
packetno=12, lastpos=26143449, pts=1742896.600000
bytes= 5923, data=0x23ef610, granulepos=1673180170=26143440| 10,
packetno=13, lastpos=26143450, pts=1742896.666667

So, just to be clear, the proposed patch is the #2, the first one is
just for testing.
Please comment.

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux_ogg_msg.diff
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20111215/d5454fc9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-demux_ogg_double.diff
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20111215/d5454fc9/attachment-0001.bin>


More information about the MPlayer-dev-eng mailing list