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

Unified Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 224093011: Move DataSourceHost to BufferedDataSourceHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows release build. Created 6 years, 8 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
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.h ('k') | media/base/data_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webmediaplayer_impl.cc
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index 451317ee6cc0cd45371c8d257c570dd4e5af54ae..afce4789ac801735137653dcaa5d00cd6742f62d 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -121,6 +121,8 @@ const char* kMediaEme = "Media.EME.";
namespace content {
+class BufferedDataSourceHostImpl;
+
#define COMPILE_ASSERT_MATCHING_ENUM(name) \
COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \
static_cast<int>(BufferedResourceLoader::k ## name), \
@@ -308,13 +310,11 @@ void WebMediaPlayerImpl::DoLoad(LoadType load_type,
}
// Otherwise it's a regular request which requires resolving the URL first.
- // TODO(sandersd): Make WMPI a DataSourceHost and pass |this| instead of
- // |&pipeline_|.
data_source_.reset(new BufferedDataSource(
main_loop_,
frame_,
media_log_.get(),
- &pipeline_,
+ &buffered_data_source_host_,
base::Bind(&WebMediaPlayerImpl::NotifyDownloading, AsWeakPtr())));
data_source_->Initialize(
url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode),
@@ -497,10 +497,14 @@ WebMediaPlayer::ReadyState WebMediaPlayerImpl::readyState() const {
const blink::WebTimeRanges& WebMediaPlayerImpl::buffered() {
DCHECK(main_loop_->BelongsToCurrentThread());
- blink::WebTimeRanges web_ranges(
- ConvertToWebTimeRanges(pipeline_.GetBufferedTimeRanges()));
- buffered_.swap(web_ranges);
- return buffered_;
+ media::Ranges<base::TimeDelta> buffered_time_ranges =
+ pipeline_.GetBufferedTimeRanges();
+ buffered_data_source_host_.AddBufferedTimeRanges(
+ &buffered_time_ranges, pipeline_.GetMediaDuration());
+ blink::WebTimeRanges buffered_web_time_ranges(
+ ConvertToWebTimeRanges(buffered_time_ranges));
+ buffered_web_time_ranges_.swap(buffered_web_time_ranges);
+ return buffered_web_time_ranges_;
}
double WebMediaPlayerImpl::maxTimeSeekable() const {
@@ -519,8 +523,9 @@ double WebMediaPlayerImpl::maxTimeSeekable() const {
bool WebMediaPlayerImpl::didLoadingProgress() const {
DCHECK(main_loop_->BelongsToCurrentThread());
-
- return pipeline_.DidLoadingProgress();
+ bool pipeline_progress = pipeline_.DidLoadingProgress();
+ bool data_progress = buffered_data_source_host_.DidLoadingProgress();
+ return pipeline_progress || data_progress;
}
void WebMediaPlayerImpl::paint(WebCanvas* canvas,
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.h ('k') | media/base/data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698