[mythtv-users] Airplay Sync with Multiple Devices - Mythtv only one out of sync

Bob H. bob.havlin at gmail.com
Wed Dec 19 07:03:55 UTC 2012


On 12/18/2012 10:25 PM, Bob H. wrote:
>
> Strange that the frontend seems to know that it is out of sync as per 
> the "diffts", but does not correct it.
> Any idea how to go about getting it to make a "diffts" correction if 
> it gets greater than say 100ms?
>

Looking at certain parts of the log I see where it drops packets, 
thereby worsening the sync problem:

2012-12-18 22:39:16.984818 D  RAOP Conn: SYNC: cur:6000691 next:6002699 
time:18446744072399043064
2012-12-18 22:39:16.984853 D  RAOP Conn: Queue=192 buffer=2248ms 
ideal=2008ms diffts:-86ms
2012-12-18 22:39:18.090822 D  RAOP Conn: Receiving SYNC packet
2012-12-18 22:39:18.090851 D  RAOP Conn: SYNC: cur:6001697 next:6003705 
time:18446744072399044170
2012-12-18 22:39:18.090885 D  RAOP Conn: Queue=207 buffer=2472ms 
ideal=2008ms diffts:15ms
2012-12-18 22:39:18.221700 I  RAOP Conn: Missed 1 packet(s): expected 
33274 got 33275 ts:6004296
2012-12-18 22:39:18.221825 I  RAOP Conn: Sent resend for 33274
2012-12-18 22:39:18.225140 D  RAOP Conn: Received required resend 33274 
(with ts:6004288 last:33276)
2012-12-18 22:39:18.632964 D  RAOP Conn: Receiving SYNC packet
2012-12-18 22:39:18.633175 D  RAOP Conn: SYNC: cur:6002703 next:6004711 
time:18446744072399044712
2012-12-18 22:39:18.633303 D  RAOP Conn: Drop 23 packets
2012-12-18 22:39:18.633333 D  RAOP Conn: Queue=251 buffer=2001ms 
ideal=2008ms diffts:-449ms
2012-12-18 22:39:18.633372 E  RAOP Conn: Audio discontinuity seen. 
Played 33076 (6002707) expected 33053
2012-12-18 22:39:19.325538 I  RAOP Conn: Missed 1 packet(s): expected 
33385 got 33386 ts:6005182
2012-12-18 22:39:19.325593 I  RAOP Conn: Sent resend for 33385
2012-12-18 22:39:19.338911 D  RAOP Conn: Received required resend 33385 
(with ts:6005174 last:33414)
2012-12-18 22:39:19.639657 D  RAOP Conn: Receiving SYNC packet
2012-12-18 22:39:19.639696 D  RAOP Conn: SYNC: cur:6003708 next:6005716 
time:18446744072399045719
2012-12-18 22:39:19.639744 D  RAOP Conn: Queue=184 buffer=2001ms 
ideal=2008ms diffts:-264ms
2012-12-18 22:39:20.644909 D  RAOP Conn: Receiving SYNC packet


The drop packets and diffts comes from mythraopconnection.cpp:
...
     uint64_t audiots = m_audio->GetAudiotime();
     if (m_audioStarted)
     {
         m_adjustedLatency = (int64_t)audiots - (int64_t)m_currentTimestamp;
     }
     if (m_adjustedLatency > (int64_t)m_bufferLength)
     {
         // Too much delay in playback
         // will reset audio card in next ProcessAudio
         m_audioStarted = false;
         m_adjustedLatency = 0;
     }

     delay += m_audio->GetAudioBufferedTime();
     delay += m_adjustedLatency;

     // Expire old audio
     ExpireResendRequests(m_currentTimestamp);
     int res = ExpireAudio(m_currentTimestamp);
     if (res > 0)
     {
         LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Drop %1 
packets").arg(res));
     }

     LOG(VB_GENERAL, LOG_DEBUG, LOC +
         QString("Queue=%1 buffer=%2ms ideal=%3ms diffts:%4ms")
         .arg(m_audioQueue.size())
         .arg(delay)
         .arg(m_bufferLength)
         .arg(m_adjustedLatency));
...

Hmmm...  Nicely coded, but I am too tired to figure it out tonight.



More information about the mythtv-users mailing list