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

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

Issue 7062042: 1;2305;0cRevert 86971 - Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
14 #include "remoting/base/capture_data.h" 15 #include "remoting/base/capture_data.h"
15 #include "remoting/base/tracer.h" 16 #include "remoting/base/tracer.h"
16 #include "remoting/proto/control.pb.h" 17 #include "remoting/proto/control.pb.h"
17 #include "remoting/proto/video.pb.h" 18 #include "remoting/proto/video.pb.h"
18 #include "remoting/protocol/client_stub.h" 19 #include "remoting/protocol/client_stub.h"
19 #include "remoting/protocol/connection_to_client.h" 20 #include "remoting/protocol/connection_to_client.h"
20 #include "remoting/protocol/message_decoder.h" 21 #include "remoting/protocol/message_decoder.h"
21 #include "remoting/protocol/util.h" 22 #include "remoting/protocol/util.h"
22 23
23 using remoting::protocol::ConnectionToClient; 24 using remoting::protocol::ConnectionToClient;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 is_recording_ = true; 144 is_recording_ = true;
144 StartCaptureTimer(); 145 StartCaptureTimer();
145 146
146 // Capture first frame immedately. 147 // Capture first frame immedately.
147 DoCapture(); 148 DoCapture();
148 } 149 }
149 150
150 void ScreenRecorder::DoStop(Task* done_task) { 151 void ScreenRecorder::DoStop(Task* done_task) {
151 DCHECK_EQ(capture_loop_, MessageLoop::current()); 152 DCHECK_EQ(capture_loop_, MessageLoop::current());
152 153
153 base::ScopedTaskRunner done_runner(done_task); 154 media::AutoTaskRunner done_runner(done_task);
154 155
155 // We might have not started when we receive a stop command, simply run the 156 // We might have not started when we receive a stop command, simply run the
156 // task and then return. 157 // task and then return.
157 if (!is_recording_) 158 if (!is_recording_)
158 return; 159 return;
159 160
160 capture_timer_.Stop(); 161 capture_timer_.Stop();
161 is_recording_ = false; 162 is_recording_ = false;
162 163
163 DCHECK_GE(recordings_, 0); 164 DCHECK_GE(recordings_, 0);
164 if (recordings_) { 165 if (recordings_) {
165 network_loop_->PostTask( 166 network_loop_->PostTask(
166 FROM_HERE, 167 FROM_HERE,
167 NewTracedMethod(this, 168 NewTracedMethod(this,
168 &ScreenRecorder::DoStopOnNetworkThread, 169 &ScreenRecorder::DoStopOnNetworkThread,
169 done_runner.Release())); 170 done_runner.release()));
170 return; 171 return;
171 } 172 }
172 } 173 }
173 174
174 void ScreenRecorder::DoSetMaxRate(double max_rate) { 175 void ScreenRecorder::DoSetMaxRate(double max_rate) {
175 DCHECK_EQ(capture_loop_, MessageLoop::current()); 176 DCHECK_EQ(capture_loop_, MessageLoop::current());
176 177
177 // TODO(hclam): Should also check for small epsilon. 178 // TODO(hclam): Should also check for small epsilon.
178 DCHECK_GT(max_rate, 0.0) << "Rate is too small."; 179 DCHECK_GT(max_rate, 0.0) << "Rate is too small.";
179 180
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 (base::Time::Now() - encode_start_time_).InMilliseconds()); 399 (base::Time::Now() - encode_start_time_).InMilliseconds());
399 packet->set_encode_time_ms(encode_time); 400 packet->set_encode_time_ms(encode_time);
400 } 401 }
401 402
402 network_loop_->PostTask( 403 network_loop_->PostTask(
403 FROM_HERE, 404 FROM_HERE,
404 NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet)); 405 NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet));
405 } 406 }
406 407
407 } // namespace remoting 408 } // 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