Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: media/filters/source_buffer_stream.cc

Issue 2171133002: Implement opus seek preroll for MediaSourceExtensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/filters/source_buffer_stream.cc
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
index 608253b2d87bc5fa38873fbc36a6a6b26f9d7203..a8b929add41bc8545928010358de8304589de3a3 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -1105,6 +1105,18 @@ void SourceBufferStream::Seek(base::TimeDelta timestamp) {
if (itr == ranges_.end())
return;
+ if (!audio_configs_.empty()) {
+ const auto& config = audio_configs_[(*itr)->GetConfigIdAtTime(seek_dts)];
+ if (config.codec() == kCodecOpus) {
+ DecodeTimestamp preroll_dts = std::max(seek_dts - config.seek_preroll(),
+ (*itr)->GetStartTimestamp());
+ if ((*itr)->CanSeekTo(preroll_dts) &&
chcunningham 2016/07/22 01:50:28 FYI: I've taken a conservative approach here. If w
wolenetz 2016/12/02 00:18:49 Acknowledged.
+ (*itr)->SameConfigThruRange(preroll_dts, seek_dts)) {
+ seek_dts = preroll_dts;
+ }
+ }
+ }
+
SeekAndSetSelectedRange(*itr, seek_dts);
seek_pending_ = false;
}

Powered by Google App Engine
This is Rietveld 408576698