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

Side by Side Diff: media/capture/screen_capture_device_core.cc

Issue 1199593005: Automatic resolution throttling for screen capture pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resolution_chooser_ITEM13
Patch Set: Addressed hubbe's nit. Created 5 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/capture/screen_capture_device_core.h" 5 #include "media/capture/screen_capture_device_core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 namespace { 17 namespace {
18 18
19 void DeleteCaptureMachine( 19 void DeleteCaptureMachine(
20 scoped_ptr<VideoCaptureMachine> capture_machine) { 20 scoped_ptr<VideoCaptureMachine> capture_machine) {
21 capture_machine.reset(); 21 capture_machine.reset();
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 VideoCaptureMachine::VideoCaptureMachine() {}
27
28 VideoCaptureMachine::~VideoCaptureMachine() {}
29
30 bool VideoCaptureMachine::IsAutoThrottlingEnabled() const {
31 return false;
32 }
33
26 void ScreenCaptureDeviceCore::AllocateAndStart( 34 void ScreenCaptureDeviceCore::AllocateAndStart(
27 const VideoCaptureParams& params, 35 const VideoCaptureParams& params,
28 scoped_ptr<VideoCaptureDevice::Client> client) { 36 scoped_ptr<VideoCaptureDevice::Client> client) {
29 DCHECK(thread_checker_.CalledOnValidThread()); 37 DCHECK(thread_checker_.CalledOnValidThread());
30 38
31 if (state_ != kIdle) { 39 if (state_ != kIdle) {
32 DVLOG(1) << "Allocate() invoked when not in state Idle."; 40 DVLOG(1) << "Allocate() invoked when not in state Idle.";
33 return; 41 return;
34 } 42 }
35 43
(...skipping 17 matching lines...) Expand all
53 } 61 }
54 62
55 if (params.requested_format.frame_size.IsEmpty()) { 63 if (params.requested_format.frame_size.IsEmpty()) {
56 const std::string error_msg = 64 const std::string error_msg =
57 "invalid frame size: " + params.requested_format.frame_size.ToString(); 65 "invalid frame size: " + params.requested_format.frame_size.ToString();
58 DVLOG(1) << error_msg; 66 DVLOG(1) << error_msg;
59 client->OnError(error_msg); 67 client->OnError(error_msg);
60 return; 68 return;
61 } 69 }
62 70
63 oracle_proxy_ = new ThreadSafeCaptureOracle(client.Pass(), params); 71 oracle_proxy_ = new ThreadSafeCaptureOracle(
72 client.Pass(), params, capture_machine_->IsAutoThrottlingEnabled());
64 73
65 capture_machine_->Start( 74 capture_machine_->Start(
66 oracle_proxy_, 75 oracle_proxy_,
67 params, 76 params,
68 base::Bind(&ScreenCaptureDeviceCore::CaptureStarted, AsWeakPtr())); 77 base::Bind(&ScreenCaptureDeviceCore::CaptureStarted, AsWeakPtr()));
69 78
70 TransitionStateTo(kCapturing); 79 TransitionStateTo(kCapturing);
71 } 80 }
72 81
73 void ScreenCaptureDeviceCore::StopAndDeAllocate() { 82 void ScreenCaptureDeviceCore::StopAndDeAllocate() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return; 140 return;
132 141
133 if (oracle_proxy_.get()) 142 if (oracle_proxy_.get())
134 oracle_proxy_->ReportError(reason); 143 oracle_proxy_->ReportError(reason);
135 144
136 StopAndDeAllocate(); 145 StopAndDeAllocate();
137 TransitionStateTo(kError); 146 TransitionStateTo(kError);
138 } 147 }
139 148
140 } // namespace media 149 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698