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

Side by Side Diff: remoting/host/screen_recorder.cc

Issue 7062013: Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add innocuous but critical BASE_API modifier to ScopedTaskRunner declaration. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/event_executor_win.cc ('k') | tools/clang/plugins/ChromeClassTester.cpp » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "remoting/host/screen_recorder.h" 5 #include "remoting/host/screen_recorder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/stl_util-inl.h" 11 #include "base/stl_util-inl.h"
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "media/base/callback.h"
15 #include "remoting/base/capture_data.h" 14 #include "remoting/base/capture_data.h"
16 #include "remoting/base/tracer.h" 15 #include "remoting/base/tracer.h"
17 #include "remoting/proto/control.pb.h" 16 #include "remoting/proto/control.pb.h"
18 #include "remoting/proto/video.pb.h" 17 #include "remoting/proto/video.pb.h"
19 #include "remoting/protocol/client_stub.h" 18 #include "remoting/protocol/client_stub.h"
20 #include "remoting/protocol/connection_to_client.h" 19 #include "remoting/protocol/connection_to_client.h"
21 #include "remoting/protocol/message_decoder.h" 20 #include "remoting/protocol/message_decoder.h"
22 #include "remoting/protocol/util.h" 21 #include "remoting/protocol/util.h"
23 22
24 using remoting::protocol::ConnectionToClient; 23 using remoting::protocol::ConnectionToClient;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 is_recording_ = true; 143 is_recording_ = true;
145 StartCaptureTimer(); 144 StartCaptureTimer();
146 145
147 // Capture first frame immedately. 146 // Capture first frame immedately.
148 DoCapture(); 147 DoCapture();
149 } 148 }
150 149
151 void ScreenRecorder::DoStop(Task* done_task) { 150 void ScreenRecorder::DoStop(Task* done_task) {
152 DCHECK_EQ(capture_loop_, MessageLoop::current()); 151 DCHECK_EQ(capture_loop_, MessageLoop::current());
153 152
154 media::AutoTaskRunner done_runner(done_task); 153 base::ScopedTaskRunner done_runner(done_task);
155 154
156 // We might have not started when we receive a stop command, simply run the 155 // We might have not started when we receive a stop command, simply run the
157 // task and then return. 156 // task and then return.
158 if (!is_recording_) 157 if (!is_recording_)
159 return; 158 return;
160 159
161 capture_timer_.Stop(); 160 capture_timer_.Stop();
162 is_recording_ = false; 161 is_recording_ = false;
163 162
164 DCHECK_GE(recordings_, 0); 163 DCHECK_GE(recordings_, 0);
165 if (recordings_) { 164 if (recordings_) {
166 network_loop_->PostTask( 165 network_loop_->PostTask(
167 FROM_HERE, 166 FROM_HERE,
168 NewTracedMethod(this, 167 NewTracedMethod(this,
169 &ScreenRecorder::DoStopOnNetworkThread, 168 &ScreenRecorder::DoStopOnNetworkThread,
170 done_runner.release())); 169 done_runner.Release()));
171 return; 170 return;
172 } 171 }
173 } 172 }
174 173
175 void ScreenRecorder::DoSetMaxRate(double max_rate) { 174 void ScreenRecorder::DoSetMaxRate(double max_rate) {
176 DCHECK_EQ(capture_loop_, MessageLoop::current()); 175 DCHECK_EQ(capture_loop_, MessageLoop::current());
177 176
178 // TODO(hclam): Should also check for small epsilon. 177 // TODO(hclam): Should also check for small epsilon.
179 DCHECK_GT(max_rate, 0.0) << "Rate is too small."; 178 DCHECK_GT(max_rate, 0.0) << "Rate is too small.";
180 179
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 (base::Time::Now() - encode_start_time_).InMilliseconds()); 398 (base::Time::Now() - encode_start_time_).InMilliseconds());
400 packet->set_encode_time_ms(encode_time); 399 packet->set_encode_time_ms(encode_time);
401 } 400 }
402 401
403 network_loop_->PostTask( 402 network_loop_->PostTask(
404 FROM_HERE, 403 FROM_HERE,
405 NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet)); 404 NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet));
406 } 405 }
407 406
408 } // namespace remoting 407 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/event_executor_win.cc ('k') | tools/clang/plugins/ChromeClassTester.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698