xbmc/xbmc — pull request #2579 by popcornmix (2013-04-09 18:29:09+00:00)
Title: [players] Fix dts time after seek

I've been having a problem on Pi with network streams that after a seek the displayed time reads zero until the first packet is received by players.
This means pressing seek twice uses the zero as the second seek's origin jumping back to near the start of the file.

For iPlayer (which uses rtmp), m_pDemuxer->SeekTime(time, msg.GetBackward(), &start) returns start=DVD_NOPTS_VALUE.

We call FlushBuffers which calls UpdatePlayState which does (on m_StateInput)

if(state.dts == DVD_NOPTS_VALUE)
state.time = 0;

and then FlushBuffers copies m_StateInput to m_state, so m_state.time = 0, which means GetTime returns zero, which is wrong.

Discussing this with FernetMenta he suggested dts should be set to the requested time, rather than the time from demuxer, so I've submitted this PR to get more opinions (e.g. from @elupus).

This does fix my iPlayer problem on the Pi. Not tested on dvdplayer, but it looks like it has the same behaviour.

A safer alternative would be to only use DVD_MSEC_TO_TIME(time) when start == DVD_NOPTS_VALUE, but I'd like to hear what is more correct.