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

Show loaded till in playback slider.

This commit is contained in:
John Preston
2019-05-31 14:45:35 +03:00
parent 0ce5405eef
commit 2255eb2c68
12 changed files with 78 additions and 33 deletions

View File

@@ -72,6 +72,9 @@ void SaveValidStartInformation(Information &to, Information &&from) {
if (from.video.state.duration != kTimeUnknown) {
SaveValidVideoInformation(to.video, std::move(from.video));
}
if (from.headerSize && !to.headerSize) {
to.headerSize = from.headerSize;
}
}
} // namespace
@@ -209,12 +212,13 @@ void Player::videoPlayedTill(crl::time position) {
trackPlayedTill(*_video, _information.video.state, position);
}
bool Player::fileReady(Stream &&video, Stream &&audio) {
bool Player::fileReady(int headerSize, Stream &&video, Stream &&audio) {
_waitingForData = false;
const auto weak = base::make_weak(&_sessionGuard);
const auto ready = [=](const Information &data) {
crl::on_main(weak, [=, data = data]() mutable {
data.headerSize = headerSize;
streamReady(std::move(data));
});
};
@@ -702,7 +706,9 @@ void Player::stop(bool stillActive) {
_durationByPackets = 0;
_durationByLastAudioPacket = 0;
_durationByLastVideoPacket = 0;
const auto header = _information.headerSize;
_information = Information();
_information.headerSize = header;
}
std::optional<Error> Player::failed() const {
@@ -801,6 +807,7 @@ Media::Player::TrackState Player::prepareLegacyState() const {
? getCurrentReceivedTill(result.length)
: 0;
result.frequency = kMsFrequency;
result.fileHeaderSize = _information.headerSize;
if (result.length == kTimeUnknown) {
const auto document = _options.audioId.audio();