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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 1879253002: Disable idle suspend for GpuVideoDecoder produced frames on OSX, Win. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 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 unified diff | Download patch
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnNaturalSizeChanged), 200 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnNaturalSizeChanged),
201 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnOpacityChanged))), 201 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnOpacityChanged))),
202 is_cdm_attached_(false), 202 is_cdm_attached_(false),
203 #if defined(OS_ANDROID) // WMPI_CAST 203 #if defined(OS_ANDROID) // WMPI_CAST
204 cast_impl_(this, client_, params.context_3d_cb()), 204 cast_impl_(this, client_, params.context_3d_cb()),
205 #endif 205 #endif
206 volume_(1.0), 206 volume_(1.0),
207 volume_multiplier_(1.0), 207 volume_multiplier_(1.0),
208 renderer_factory_(std::move(renderer_factory)), 208 renderer_factory_(std::move(renderer_factory)),
209 surface_manager_(params.surface_manager()), 209 surface_manager_(params.surface_manager()),
210 suppress_destruction_errors_(false) { 210 suppress_destruction_errors_(false),
211 can_suspend_state_(CanSuspendState::UNKNOWN) {
211 DCHECK(!adjust_allocated_memory_cb_.is_null()); 212 DCHECK(!adjust_allocated_memory_cb_.is_null());
212 DCHECK(renderer_factory_); 213 DCHECK(renderer_factory_);
213 DCHECK(client_); 214 DCHECK(client_);
214 215
215 if (delegate_) 216 if (delegate_)
216 delegate_id_ = delegate_->AddObserver(this); 217 delegate_id_ = delegate_->AddObserver(this);
217 218
218 media_log_->AddEvent( 219 media_log_->AddEvent(
219 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 220 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED));
220 221
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 1073
1073 void WebMediaPlayerImpl::OnShown() { 1074 void WebMediaPlayerImpl::OnShown() {
1074 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1075 DCHECK(main_task_runner_->BelongsToCurrentThread());
1075 must_suspend_ = false; 1076 must_suspend_ = false;
1076 UpdatePlayState(); 1077 UpdatePlayState();
1077 } 1078 }
1078 1079
1079 void WebMediaPlayerImpl::OnSuspendRequested(bool must_suspend) { 1080 void WebMediaPlayerImpl::OnSuspendRequested(bool must_suspend) {
1080 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1081 DCHECK(main_task_runner_->BelongsToCurrentThread());
1081 1082
1082 #if defined(OS_MACOSX) 1083 #if defined(OS_MACOSX) || defined(OS_WIN)
sandersd (OOO until July 31) 2016/04/12 23:19:19 Move this check into SetSuspendState(), now that t
DaleCurtis 2016/04/12 23:33:29 Done. I was surprised to see that SetSuspendState(
1083 // TODO(sandersd): Idle suspend is disabled on OSX since hardware decoded 1084 // TODO(sandersd): Idle suspend is disabled on OSX and Windows for hardware
1084 // frames are owned by the video decoder in the GPU process. A mechanism for 1085 // decoding / opaque video frames since hardware decoded frames are owned by
1085 // detaching ownership from the decoder is needed. http://crbug.com/595716. 1086 // the video decoder in the GPU process. Remove once OSX and Windows hardware
1086 return; 1087 // decoders support frames which outlive the decoder. http://crbug.com/595716
1088 // and http://crbug.com/602708.
1089 if (can_suspend_state_ == CanSuspendState::UNKNOWN) {
1090 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor();
1091 if (frame) {
1092 can_suspend_state_ =
1093 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME)
1094 ? CanSuspendState::NO
1095 : CanSuspendState::YES;
1096 }
1097 }
1098 #else
1099 can_suspend_state_ = CanSuspendState::YES;
1087 #endif 1100 #endif
1088 1101
1102 if (can_suspend_state_ == CanSuspendState::NO)
1103 return;
1104
1089 if (must_suspend) { 1105 if (must_suspend) {
1090 must_suspend_ = true; 1106 must_suspend_ = true;
1091 } else { 1107 } else {
1092 // TODO(sandersd): Remove this when idleness is separate from play state. 1108 // TODO(sandersd): Remove this when idleness is separate from play state.
1093 if (delegate_state_ == DelegateState::PAUSED_BUT_NOT_IDLE) 1109 if (delegate_state_ == DelegateState::PAUSED_BUT_NOT_IDLE)
1094 return; 1110 return;
1095 is_idle_ = true; 1111 is_idle_ = true;
1096 } 1112 }
1097 1113
1098 UpdatePlayState(); 1114 UpdatePlayState();
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1608 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1593 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1609 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1594 << ", Demuxer: " << demuxer_memory_usage; 1610 << ", Demuxer: " << demuxer_memory_usage;
1595 1611
1596 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1612 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1597 last_reported_memory_usage_ = current_memory_usage; 1613 last_reported_memory_usage_ = current_memory_usage;
1598 adjust_allocated_memory_cb_.Run(delta); 1614 adjust_allocated_memory_cb_.Run(delta);
1599 } 1615 }
1600 1616
1601 } // namespace media 1617 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698