| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/media/media_recorder_handler.h" | 5 #include "content/renderer/media/media_recorder_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 202 } |
| 203 | 203 |
| 204 void MediaRecorderHandler::pause() { | 204 void MediaRecorderHandler::pause() { |
| 205 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 205 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 206 DCHECK(recording_); | 206 DCHECK(recording_); |
| 207 recording_ = false; | 207 recording_ = false; |
| 208 for (const auto& video_recorder : video_recorders_) | 208 for (const auto& video_recorder : video_recorders_) |
| 209 video_recorder->Pause(); | 209 video_recorder->Pause(); |
| 210 for (const auto& audio_recorder : audio_recorders_) | 210 for (const auto& audio_recorder : audio_recorders_) |
| 211 audio_recorder->Pause(); | 211 audio_recorder->Pause(); |
| 212 webm_muxer_->Pause(); |
| 212 } | 213 } |
| 213 | 214 |
| 214 void MediaRecorderHandler::resume() { | 215 void MediaRecorderHandler::resume() { |
| 215 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 216 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 216 DCHECK(!recording_); | 217 DCHECK(!recording_); |
| 217 recording_ = true; | 218 recording_ = true; |
| 218 for (const auto& video_recorder : video_recorders_) | 219 for (const auto& video_recorder : video_recorders_) |
| 219 video_recorder->Resume(); | 220 video_recorder->Resume(); |
| 220 for (const auto& audio_recorder : audio_recorders_) | 221 for (const auto& audio_recorder : audio_recorders_) |
| 221 audio_recorder->Resume(); | 222 audio_recorder->Resume(); |
| 223 webm_muxer_->Resume(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 void MediaRecorderHandler::OnEncodedVideo( | 226 void MediaRecorderHandler::OnEncodedVideo( |
| 225 const scoped_refptr<media::VideoFrame>& video_frame, | 227 const scoped_refptr<media::VideoFrame>& video_frame, |
| 226 scoped_ptr<std::string> encoded_data, | 228 scoped_ptr<std::string> encoded_data, |
| 227 TimeTicks timestamp, | 229 TimeTicks timestamp, |
| 228 bool is_key_frame) { | 230 bool is_key_frame) { |
| 229 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 231 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 230 if (!webm_muxer_) | 232 if (!webm_muxer_) |
| 231 return; | 233 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 recorder->OnData(audio_bus, timestamp); | 273 recorder->OnData(audio_bus, timestamp); |
| 272 } | 274 } |
| 273 | 275 |
| 274 void MediaRecorderHandler::SetAudioFormatForTesting( | 276 void MediaRecorderHandler::SetAudioFormatForTesting( |
| 275 const media::AudioParameters& params) { | 277 const media::AudioParameters& params) { |
| 276 for (auto* recorder : audio_recorders_) | 278 for (auto* recorder : audio_recorders_) |
| 277 recorder->OnSetFormat(params); | 279 recorder->OnSetFormat(params); |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace content | 282 } // namespace content |
| OLD | NEW |