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

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

Issue 2495753002: Reenable idle suspension of media elements on Windows. (Closed)
Patch Set: add destructor Created 4 years, 1 month 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 | « no previous file | media/gpu/dxva_picture_buffer_win.h » ('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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 } 1754 }
1755 1755
1756 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) { 1756 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) {
1757 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1757 DCHECK(main_task_runner_->BelongsToCurrentThread());
1758 1758
1759 // Do not change the state after an error has occurred. 1759 // Do not change the state after an error has occurred.
1760 // TODO(sandersd): Update PipelineController to remove the need for this. 1760 // TODO(sandersd): Update PipelineController to remove the need for this.
1761 if (IsNetworkStateError(network_state_)) 1761 if (IsNetworkStateError(network_state_))
1762 return; 1762 return;
1763 1763
1764 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_MACOSX) 1764 #if !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && \
DaleCurtis 2016/11/11 23:16:16 That's everything now :)
jbauman 2016/11/11 23:17:15 Ok, I wasn't sure if Chromecast was included here
DaleCurtis 2016/11/11 23:34:53 Ah, you're right they're still using this workarou
1765 !defined(OS_MACOSX)
1765 // TODO(sandersd): idle suspend is disabled if decoder owns video frame. 1766 // TODO(sandersd): idle suspend is disabled if decoder owns video frame.
1766 // Used on Windows+Chromecast. Since GetCurrentFrameFromCompositor is a 1767 // Used on Windows+Chromecast. Since GetCurrentFrameFromCompositor is a
1767 // synchronous cross-thread post, avoid the cost on platforms that always 1768 // synchronous cross-thread post, avoid the cost on platforms that always
1768 // allow suspend. Need to find a better mechanism for this. See 1769 // allow suspend. Need to find a better mechanism for this. See
1769 // http://crbug.com/602708 1770 // http://crbug.com/602708
1770 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { 1771 if (can_suspend_state_ == CanSuspendState::UNKNOWN) {
1771 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); 1772 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor();
1772 if (frame) { 1773 if (frame) {
1773 can_suspend_state_ = 1774 can_suspend_state_ =
1774 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) 1775 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 pipeline_metadata_.natural_size, 1953 pipeline_metadata_.natural_size,
1953 base::Bind(&GetCurrentTimeInternal, this))); 1954 base::Bind(&GetCurrentTimeInternal, this)));
1954 watch_time_reporter_->OnVolumeChange(volume_); 1955 watch_time_reporter_->OnVolumeChange(volume_);
1955 if (delegate_ && delegate_->IsHidden()) 1956 if (delegate_ && delegate_->IsHidden())
1956 watch_time_reporter_->OnHidden(); 1957 watch_time_reporter_->OnHidden();
1957 else 1958 else
1958 watch_time_reporter_->OnShown(); 1959 watch_time_reporter_->OnShown();
1959 } 1960 }
1960 1961
1961 } // namespace media 1962 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/gpu/dxva_picture_buffer_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698