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

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: Feedback Created 4 years 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
« no previous file with comments | « media/filters/source_buffer_range.cc ('k') | media/test/pipeline_integration_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/source_buffer_stream.cc
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
index 82fe81f1f26b327420c16937386caab7fbfeec4e..fe3dbfea4fca61cd406a420363b5ea62b194e62b 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -1229,6 +1229,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) &&
+ (*itr)->SameConfigThruRange(preroll_dts, seek_dts)) {
+ seek_dts = preroll_dts;
+ }
+ }
+ }
+
SeekAndSetSelectedRange(*itr, seek_dts);
seek_pending_ = false;
}
« no previous file with comments | « media/filters/source_buffer_range.cc ('k') | media/test/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698