2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

Use shared player for each document.

This commit is contained in:
John Preston
2019-12-11 13:15:48 +03:00
parent f91f77ff2e
commit bfa5accc29
9 changed files with 191 additions and 135 deletions

View File

@@ -1167,9 +1167,13 @@ std::shared_ptr<::Media::Streaming::Document> Session::documentStreamer(
return result;
}
}
auto reader = documentStreamedReader(document, origin);
if (!reader) {
return nullptr;
}
auto result = std::make_shared<::Media::Streaming::Document>(
document,
origin);
std::move(reader));
if (!PruneDestroyedAndSet(_streamedDocuments, document, result)) {
_streamedDocuments.emplace_or_assign(document, result);
}