Skip to content

Commit

Permalink
Source/WebCore: Improve audio/video sync code
Browse files Browse the repository at this point in the history
- change the condition to && - previously it was always true
- add explicit cast to double - previously the result was always 0
  • Loading branch information
deadwood2 committed Aug 29, 2016
1 parent d3e88c7 commit 34cc7ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/WebCore/platform/mui/MediaPlayerPrivateMorphOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ void MediaPlayerPrivate::videoDecoder()

D(kprintf("[Video Thread] V-A Delta: %f\n", avdelta));

if(avdelta < 0.1 || avdelta > -0.1)
if(avdelta < 0.1 && avdelta > -0.1)
{
delay += avdelta;
}
Expand Down Expand Up @@ -2637,7 +2637,8 @@ void MediaPlayerPrivate::audioDecoder()
_Stream *stream = m_ctx->audio_stream;

// Actual timecode considering the buffered audio data in output buffer
m_ctx->audio_timecode -= stream->written_len/(stream->sample_rate*(stream->sample_bits/8)*stream->sample_channels);
m_ctx->audio_timecode -= ((double)(stream->written_len))/(stream->sample_rate*(stream->sample_bits/8)*stream->sample_channels);
if (m_ctx->audio_timecode < 0.0) m_ctx->audio_timecode = 0.0; //Can happen due to precision

// Delay to next frame, which should be related to decoded buffersize. XXX: handle speed factor there */
delay -= decodeTime;
Expand Down

0 comments on commit 34cc7ab

Please sign in to comment.