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

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

Issue 2495753002: Reenable idle suspension of media elements on Windows. (Closed)
Patch Set: add comment 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_LINUX)
1765 // TODO(sandersd): idle suspend is disabled if decoder owns video frame. 1765 // TODO(sandersd): idle suspend is disabled if decoder owns video frame.
1766 // Used on Windows+Chromecast. Since GetCurrentFrameFromCompositor is a 1766 // Used on Chromecast. Since GetCurrentFrameFromCompositor is a synchronous
1767 // synchronous cross-thread post, avoid the cost on platforms that always 1767 // cross-thread post, avoid the cost on platforms that always allow suspend.
1768 // allow suspend. Need to find a better mechanism for this. See 1768 // Need to find a better mechanism for this. See http://crbug.com/602708
1769 // http://crbug.com/602708
1770 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { 1769 if (can_suspend_state_ == CanSuspendState::UNKNOWN) {
1771 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); 1770 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor();
1772 if (frame) { 1771 if (frame) {
1773 can_suspend_state_ = 1772 can_suspend_state_ =
1774 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) 1773 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME)
1775 ? CanSuspendState::NO 1774 ? CanSuspendState::NO
1776 : CanSuspendState::YES; 1775 : CanSuspendState::YES;
1777 } 1776 }
1778 } 1777 }
1779 #else 1778 #else
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 pipeline_metadata_.natural_size, 1951 pipeline_metadata_.natural_size,
1953 base::Bind(&GetCurrentTimeInternal, this))); 1952 base::Bind(&GetCurrentTimeInternal, this)));
1954 watch_time_reporter_->OnVolumeChange(volume_); 1953 watch_time_reporter_->OnVolumeChange(volume_);
1955 if (delegate_ && delegate_->IsHidden()) 1954 if (delegate_ && delegate_->IsHidden())
1956 watch_time_reporter_->OnHidden(); 1955 watch_time_reporter_->OnHidden();
1957 else 1956 else
1958 watch_time_reporter_->OnShown(); 1957 watch_time_reporter_->OnShown();
1959 } 1958 }
1960 1959
1961 } // namespace media 1960 } // 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