| 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_recorder/media_recorder_handler.h" | 5 #include "content/renderer/media_recorder/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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 for (const auto& video_recorder : video_recorders_) | 263 for (const auto& video_recorder : video_recorders_) |
| 264 video_recorder->Resume(); | 264 video_recorder->Resume(); |
| 265 for (const auto& audio_recorder : audio_recorders_) | 265 for (const auto& audio_recorder : audio_recorders_) |
| 266 audio_recorder->Resume(); | 266 audio_recorder->Resume(); |
| 267 webm_muxer_->Resume(); | 267 webm_muxer_->Resume(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void MediaRecorderHandler::OnEncodedVideo( | 270 void MediaRecorderHandler::OnEncodedVideo( |
| 271 const media::WebmMuxer::VideoParameters& params, | 271 const media::WebmMuxer::VideoParameters& params, |
| 272 std::unique_ptr<std::string> encoded_data, | 272 std::unique_ptr<std::string> encoded_data, |
| 273 std::unique_ptr<std::string> encoded_alpha, |
| 273 TimeTicks timestamp, | 274 TimeTicks timestamp, |
| 274 bool is_key_frame) { | 275 bool is_key_frame) { |
| 275 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 276 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 276 | 277 |
| 277 if (UpdateTracksAndCheckIfChanged()) { | 278 if (UpdateTracksAndCheckIfChanged()) { |
| 278 client_->onError("Amount of tracks in MediaStream has changed."); | 279 client_->onError("Amount of tracks in MediaStream has changed."); |
| 279 return; | 280 return; |
| 280 } | 281 } |
| 281 if (!webm_muxer_) | 282 if (!webm_muxer_) |
| 282 return; | 283 return; |
| 283 if (!webm_muxer_->OnEncodedVideo(params, std::move(encoded_data), timestamp, | 284 if (!webm_muxer_->OnEncodedVideo(params, std::move(encoded_data), |
| 285 std::move(encoded_alpha), timestamp, |
| 284 is_key_frame)) { | 286 is_key_frame)) { |
| 285 DLOG(ERROR) << "Error muxing video data"; | 287 DLOG(ERROR) << "Error muxing video data"; |
| 286 client_->onError("Error muxing video data"); | 288 client_->onError("Error muxing video data"); |
| 287 } | 289 } |
| 288 } | 290 } |
| 289 | 291 |
| 290 void MediaRecorderHandler::OnEncodedAudio( | 292 void MediaRecorderHandler::OnEncodedAudio( |
| 291 const media::AudioParameters& params, | 293 const media::AudioParameters& params, |
| 292 std::unique_ptr<std::string> encoded_data, | 294 std::unique_ptr<std::string> encoded_data, |
| 293 base::TimeTicks timestamp) { | 295 base::TimeTicks timestamp) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 recorder->OnData(audio_bus, timestamp); | 375 recorder->OnData(audio_bus, timestamp); |
| 374 } | 376 } |
| 375 | 377 |
| 376 void MediaRecorderHandler::SetAudioFormatForTesting( | 378 void MediaRecorderHandler::SetAudioFormatForTesting( |
| 377 const media::AudioParameters& params) { | 379 const media::AudioParameters& params) { |
| 378 for (const auto& recorder : audio_recorders_) | 380 for (const auto& recorder : audio_recorders_) |
| 379 recorder->OnSetFormat(params); | 381 recorder->OnSetFormat(params); |
| 380 } | 382 } |
| 381 | 383 |
| 382 } // namespace content | 384 } // namespace content |
| OLD | NEW |