OLD | NEW |
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 "remoting/host/video_frame_recorder.h" | 5 #include "remoting/host/video_frame_recorder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 content_bytes_ = 0; | 153 content_bytes_ = 0; |
154 | 154 |
155 // Tell the wrapper to stop recording and posting frames to us. | 155 // Tell the wrapper to stop recording and posting frames to us. |
156 if (encoder_task_runner_.get()) { | 156 if (encoder_task_runner_.get()) { |
157 encoder_task_runner_->PostTask(FROM_HERE, | 157 encoder_task_runner_->PostTask(FROM_HERE, |
158 base::Bind(&RecordingVideoEncoder::set_enable_recording, | 158 base::Bind(&RecordingVideoEncoder::set_enable_recording, |
159 recording_encoder_, false)); | 159 recording_encoder_, false)); |
160 } | 160 } |
161 | 161 |
162 // Detach this recorder from the calling and encode threads. | 162 // Detach this recorder from the calling and encode threads. |
163 caller_task_runner_ = NULL; | 163 caller_task_runner_ = nullptr; |
164 encoder_task_runner_ = NULL; | 164 encoder_task_runner_ = nullptr; |
165 } | 165 } |
166 | 166 |
167 void VideoFrameRecorder::SetEnableRecording(bool enable_recording) { | 167 void VideoFrameRecorder::SetEnableRecording(bool enable_recording) { |
168 DCHECK(!caller_task_runner_.get() || | 168 DCHECK(!caller_task_runner_.get() || |
169 caller_task_runner_->BelongsToCurrentThread()); | 169 caller_task_runner_->BelongsToCurrentThread()); |
170 | 170 |
171 if (enable_recording_ == enable_recording) { | 171 if (enable_recording_ == enable_recording) { |
172 return; | 172 return; |
173 } | 173 } |
174 enable_recording_ = enable_recording; | 174 enable_recording_ = enable_recording; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (content_bytes_ + frame_bytes > max_content_bytes_) { | 239 if (content_bytes_ + frame_bytes > max_content_bytes_) { |
240 return; | 240 return; |
241 } | 241 } |
242 | 242 |
243 // Store the frame and update the content byte count. | 243 // Store the frame and update the content byte count. |
244 recorded_frames_.push_back(frame.release()); | 244 recorded_frames_.push_back(frame.release()); |
245 content_bytes_ += frame_bytes; | 245 content_bytes_ += frame_bytes; |
246 } | 246 } |
247 | 247 |
248 } // namespace remoting | 248 } // namespace remoting |
OLD | NEW |