Skip to content

Commit

Permalink
Fixed audio out of sync when playing videos
Browse files Browse the repository at this point in the history
Also in certain conditions, especially on slower hardware, when there is nothing to update on the screen and only videos are playing the framerate decreases significantly. Fixed by forcing screen update when at least one video is playing.
  • Loading branch information
oomek committed Mar 16, 2019
1 parent e8b6940 commit fe7bf4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/media.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ void FeVideoImp::video_thread()
//
if ( detached_frame )
{
wait_time = (sf::Int64)detached_frame->pts * time_base

wait_time = sf::seconds( detached_frame->pts
* av_q2d( m_parent->m_imp->m_format_ctx->streams[stream_id]->time_base ))
- m_parent->get_video_time();

if ( wait_time < max_sleep )
Expand Down Expand Up @@ -1159,8 +1161,8 @@ bool FeMedia::tick()
{
m_video->display_texture->update( m_video->display_frame );
m_video->display_frame = NULL;
return true;
}
return true;
}

return false;
Expand Down

0 comments on commit fe7bf4d

Please sign in to comment.