2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix sync video to audio.

This commit is contained in:
John Preston
2019-02-25 14:17:25 +04:00
parent d37b65e624
commit ccd04b98b9
8 changed files with 26 additions and 54 deletions

View File

@@ -98,7 +98,6 @@ void Player::checkNextFrame() {
if (now < _nextFrameTime) {
_renderFrameTimer.callOnce(_nextFrameTime - now);
} else {
_renderFrameTimer.cancel();
renderFrame(now);
}
}
@@ -269,20 +268,12 @@ bool Player::fileProcessPacket(Packet &&packet) {
}
} else if (_audio && _audio->streamIndex() == native.stream_index) {
const auto time = PacketPosition(packet, _audio->streamTimeBase());
//LOG(("[%2] AUDIO PACKET FOR %1ms"
// ).arg(time
// ).arg(crl::now() % 10000, 4, 10, QChar('0')));
crl::on_main(&_sessionGuard, [=] {
audioReceivedTill(time);
});
_audio->process(std::move(packet));
} else if (_video && _video->streamIndex() == native.stream_index) {
const auto time = PacketPosition(packet, _video->streamTimeBase());
//LOG(("[%2] VIDEO PACKET FOR %1ms"
// ).arg(time
// ).arg(crl::now() % 10000, 4, 10, QChar('0')));
crl::on_main(&_sessionGuard, [=] {
videoReceivedTill(time);
});