Ticket #1827: dvd_seeking_improvements_v1.patch

File dvd_seeking_improvements_v1.patch, 819 bytes (added by skamithi, 18 years ago)

if dvdnav_get_pos fails the first time, have some delay then try again. if its still wrong..oh well. seems to work most of the time. still testing.

  • DVDRingBuffer.cpp

     
    136136    }
    137137}
    138138
     139/** \fn DVDRingBufferPriv::GetReadPosition()
     140 *  \brief returns current position in the PGC.
     141 */
    139142long long DVDRingBufferPriv::GetReadPosition(void)
    140143{
    141     uint32_t pos;
    142     uint32_t length;
    143 
    144     if (dvdnav)       
    145         dvdnav_get_position(dvdnav, &pos, &length);
    146 
     144    uint32_t pos = 0;
     145    uint32_t length = 1;
     146    if (dvdnav)
     147    {
     148        if (dvdnav_get_position(dvdnav, &pos, &length) == DVDNAV_STATUS_ERR)
     149        {
     150            // try one more time
     151            usleep(10000);
     152            dvdnav_get_position(dvdnav, &pos, &length);
     153        }
     154    }
    147155    return pos * DVD_BLOCK_SIZE;
    148156}
    149157