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

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

Issue 210743002: Revert 259154 "Remove HasAudio(), HasVideo(), GetInitialNaturalS..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | « trunk/src/content/renderer/media/webmediaplayer_impl.h ('k') | trunk/src/media/base/pipeline.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/content/renderer/media/webmediaplayer_impl.cc
===================================================================
--- trunk/src/content/renderer/media/webmediaplayer_impl.cc (revision 259158)
+++ trunk/src/content/renderer/media/webmediaplayer_impl.cc (working copy)
@@ -436,19 +436,19 @@
bool WebMediaPlayerImpl::hasVideo() const {
DCHECK(main_loop_->BelongsToCurrentThread());
- return pipeline_metadata_.has_video;
+ return pipeline_.HasVideo();
}
bool WebMediaPlayerImpl::hasAudio() const {
DCHECK(main_loop_->BelongsToCurrentThread());
- return pipeline_metadata_.has_audio;
+ return pipeline_.HasAudio();
}
blink::WebSize WebMediaPlayerImpl::naturalSize() const {
DCHECK(main_loop_->BelongsToCurrentThread());
- return blink::WebSize(pipeline_metadata_.natural_size);
+ return blink::WebSize(natural_size_);
}
bool WebMediaPlayerImpl::paused() const {
@@ -943,19 +943,33 @@
InvalidateOnMainThread();
}
-void WebMediaPlayerImpl::OnPipelineMetadata(
- media::PipelineMetadata metadata) {
- DVLOG(1) << "OnPipelineMetadata";
+void WebMediaPlayerImpl::OnPipelineBufferingState(
+ media::Pipeline::BufferingState buffering_state) {
+ DVLOG(1) << "OnPipelineBufferingState(" << buffering_state << ")";
- pipeline_metadata_ = metadata;
+ switch (buffering_state) {
+ case media::Pipeline::kHaveMetadata:
+ // TODO(scherkus): Would be better to have a metadata changed callback
+ // that contained the size information as well whether audio/video is
+ // present. Doing so would let us remove more methods off Pipeline.
+ natural_size_ = pipeline_.GetInitialNaturalSize();
- SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
+ SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
- if (hasVideo()) {
- DCHECK(!video_weblayer_);
- video_weblayer_.reset(new webkit::WebLayerImpl(
- cc::VideoLayer::Create(compositor_.GetVideoFrameProvider())));
- client_->setWebLayer(video_weblayer_.get());
+ if (hasVideo()) {
+ DCHECK(!video_weblayer_);
+ video_weblayer_.reset(new webkit::WebLayerImpl(
+ cc::VideoLayer::Create(compositor_.GetVideoFrameProvider())));
+ client_->setWebLayer(video_weblayer_.get());
+ }
+ break;
+ case media::Pipeline::kPrerollCompleted:
+ // Only transition to ReadyStateHaveEnoughData if we don't have
+ // any pending seeks because the transition can cause Blink to
+ // report that the most recent seek has completed.
+ if (!pending_seek_)
+ SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
+ break;
}
// TODO(scherkus): This should be handled by HTMLMediaElement and controls
@@ -963,21 +977,6 @@
InvalidateOnMainThread();
}
-void WebMediaPlayerImpl::OnPipelinePrerollCompleted() {
- DVLOG(1) << "OnPipelinePrerollCompleted";
-
- // Only transition to ReadyStateHaveEnoughData if we don't have
- // any pending seeks because the transition can cause Blink to
- // report that the most recent seek has completed.
- if (!pending_seek_) {
- SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
-
- // TODO(scherkus): This should be handled by HTMLMediaElement and controls
- // should know when to invalidate themselves http://crbug.com/337015
- InvalidateOnMainThread();
- }
-}
-
void WebMediaPlayerImpl::OnDemuxerOpened() {
DCHECK(main_loop_->BelongsToCurrentThread());
client_->mediaSourceOpened(new WebMediaSourceImpl(
@@ -1196,8 +1195,7 @@
BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded),
BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError),
BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineSeek),
- BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata),
- BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelinePrerollCompleted),
+ BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingState),
BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChange));
}
@@ -1259,7 +1257,7 @@
media_log_->AddEvent(
media_log_->CreateVideoSizeSetEvent(size.width(), size.height()));
- pipeline_metadata_.natural_size = size;
+ natural_size_ = size;
client_->sizeChanged();
}
« no previous file with comments | « trunk/src/content/renderer/media/webmediaplayer_impl.h ('k') | trunk/src/media/base/pipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698