| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 audio_recorders_.clear(); | 195 audio_recorders_.clear(); |
| 196 webm_muxer_.reset(); | 196 webm_muxer_.reset(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void MediaRecorderHandler::pause() { | 199 void MediaRecorderHandler::pause() { |
| 200 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 200 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 201 DCHECK(recording_); | 201 DCHECK(recording_); |
| 202 recording_ = false; | 202 recording_ = false; |
| 203 for (const auto& video_recorder : video_recorders_) | 203 for (const auto& video_recorder : video_recorders_) |
| 204 video_recorder->Pause(); | 204 video_recorder->Pause(); |
| 205 for (const auto& audio_recorder : audio_recorders_) |
| 206 audio_recorder->Pause(); |
| 205 } | 207 } |
| 206 | 208 |
| 207 void MediaRecorderHandler::resume() { | 209 void MediaRecorderHandler::resume() { |
| 208 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 210 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 209 DCHECK(!recording_); | 211 DCHECK(!recording_); |
| 210 recording_ = true; | 212 recording_ = true; |
| 211 for (const auto& video_recorder : video_recorders_) | 213 for (const auto& video_recorder : video_recorders_) |
| 212 video_recorder->Resume(); | 214 video_recorder->Resume(); |
| 215 for (const auto& audio_recorder : audio_recorders_) |
| 216 audio_recorder->Resume(); |
| 213 } | 217 } |
| 214 | 218 |
| 215 void MediaRecorderHandler::OnEncodedVideo( | 219 void MediaRecorderHandler::OnEncodedVideo( |
| 216 const scoped_refptr<media::VideoFrame>& video_frame, | 220 const scoped_refptr<media::VideoFrame>& video_frame, |
| 217 scoped_ptr<std::string> encoded_data, | 221 scoped_ptr<std::string> encoded_data, |
| 218 TimeTicks timestamp, | 222 TimeTicks timestamp, |
| 219 bool is_key_frame) { | 223 bool is_key_frame) { |
| 220 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 224 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 221 if (!webm_muxer_) | 225 if (!webm_muxer_) |
| 222 return; | 226 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 recorder->OnData(audio_bus, timestamp); | 266 recorder->OnData(audio_bus, timestamp); |
| 263 } | 267 } |
| 264 | 268 |
| 265 void MediaRecorderHandler::SetAudioFormatForTesting( | 269 void MediaRecorderHandler::SetAudioFormatForTesting( |
| 266 const media::AudioParameters& params) { | 270 const media::AudioParameters& params) { |
| 267 for (auto* recorder : audio_recorders_) | 271 for (auto* recorder : audio_recorders_) |
| 268 recorder->OnSetFormat(params); | 272 recorder->OnSetFormat(params); |
| 269 } | 273 } |
| 270 | 274 |
| 271 } // namespace content | 275 } // namespace content |
| OLD | NEW |