| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/renderer/media/video_track_recorder.h" | 10 #include "content/renderer/media/video_track_recorder.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 recording_ = false; | 112 recording_ = false; |
| 113 video_recorders_.clear(); | 113 video_recorders_.clear(); |
| 114 webm_muxer_.reset(); | 114 webm_muxer_.reset(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void MediaRecorderHandler::pause() { | 117 void MediaRecorderHandler::pause() { |
| 118 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 118 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 119 DCHECK(recording_); | 119 DCHECK(recording_); |
| 120 recording_ = false; | 120 recording_ = false; |
| 121 NOTIMPLEMENTED(); | 121 for (const auto& video_recorder : video_recorders_) |
| 122 video_recorder->Pause(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void MediaRecorderHandler::resume() { | 125 void MediaRecorderHandler::resume() { |
| 125 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 126 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 126 DCHECK(!recording_); | 127 DCHECK(!recording_); |
| 127 recording_ = true; | 128 recording_ = true; |
| 128 NOTIMPLEMENTED(); | 129 for (const auto& video_recorder : video_recorders_) |
| 130 video_recorder->Resume(); |
| 129 } | 131 } |
| 130 | 132 |
| 131 void MediaRecorderHandler::OnEncodedVideo( | 133 void MediaRecorderHandler::OnEncodedVideo( |
| 132 const scoped_refptr<media::VideoFrame>& video_frame, | 134 const scoped_refptr<media::VideoFrame>& video_frame, |
| 133 scoped_ptr<std::string> encoded_data, | 135 scoped_ptr<std::string> encoded_data, |
| 134 base::TimeTicks timestamp, | 136 base::TimeTicks timestamp, |
| 135 bool is_key_frame) { | 137 bool is_key_frame) { |
| 136 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 138 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 137 if (webm_muxer_) { | 139 if (webm_muxer_) { |
| 138 webm_muxer_->OnEncodedVideo(video_frame, encoded_data.Pass(), timestamp, | 140 webm_muxer_->OnEncodedVideo(video_frame, encoded_data.Pass(), timestamp, |
| 139 is_key_frame); | 141 is_key_frame); |
| 140 } | 142 } |
| 141 } | 143 } |
| 142 | 144 |
| 143 void MediaRecorderHandler::WriteData(base::StringPiece data) { | 145 void MediaRecorderHandler::WriteData(base::StringPiece data) { |
| 144 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 146 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 145 client_->writeData(data.data(), data.length(), false /* lastInSlice */); | 147 client_->writeData(data.data(), data.length(), false /* lastInSlice */); |
| 146 } | 148 } |
| 147 | 149 |
| 148 void MediaRecorderHandler::OnVideoFrameForTesting( | 150 void MediaRecorderHandler::OnVideoFrameForTesting( |
| 149 const scoped_refptr<media::VideoFrame>& frame, | 151 const scoped_refptr<media::VideoFrame>& frame, |
| 150 const base::TimeTicks& timestamp) { | 152 const base::TimeTicks& timestamp) { |
| 151 for (auto* recorder : video_recorders_) | 153 for (auto* recorder : video_recorders_) |
| 152 recorder->OnVideoFrameForTesting(frame, timestamp); | 154 recorder->OnVideoFrameForTesting(frame, timestamp); |
| 153 } | 155 } |
| 154 | 156 |
| 155 } // namespace content | 157 } // namespace content |
| OLD | NEW |