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/video_track_recorder.h" | 5 #include "content/renderer/media/video_track_recorder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 kMinFrameDuration)); | 317 kMinFrameDuration)); |
318 } | 318 } |
319 | 319 |
320 VideoTrackRecorder::VideoTrackRecorder( | 320 VideoTrackRecorder::VideoTrackRecorder( |
321 const blink::WebMediaStreamTrack& track, | 321 const blink::WebMediaStreamTrack& track, |
322 const OnEncodedVideoCB& on_encoded_video_callback) | 322 const OnEncodedVideoCB& on_encoded_video_callback) |
323 : track_(track), | 323 : track_(track), |
324 encoder_(new VpxEncoder(on_encoded_video_callback)) { | 324 encoder_(new VpxEncoder(on_encoded_video_callback)) { |
325 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 325 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
326 DCHECK(!track_.isNull()); | 326 DCHECK(!track_.isNull()); |
327 DCHECK(track.extraData()); | 327 DCHECK(track_.extraData()); |
328 | 328 |
329 // StartFrameEncode() will be called on Render IO thread. | 329 // StartFrameEncode() will be called on Render IO thread. |
330 AddToVideoTrack(this, | 330 AddToVideoTrack(this, |
331 base::Bind(&VideoTrackRecorder::VpxEncoder::StartFrameEncode, | 331 base::Bind(&VideoTrackRecorder::VpxEncoder::StartFrameEncode, |
332 encoder_), | 332 encoder_), |
333 track_); | 333 track_); |
334 } | 334 } |
335 | 335 |
336 VideoTrackRecorder::~VideoTrackRecorder() { | 336 VideoTrackRecorder::~VideoTrackRecorder() { |
337 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 337 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
338 RemoveFromVideoTrack(this, track_); | 338 RemoveFromVideoTrack(this, track_); |
339 track_.reset(); | 339 track_.reset(); |
340 } | 340 } |
341 | 341 |
342 void VideoTrackRecorder::OnVideoFrameForTesting( | 342 void VideoTrackRecorder::OnVideoFrameForTesting( |
343 const scoped_refptr<media::VideoFrame>& frame, | 343 const scoped_refptr<media::VideoFrame>& frame, |
344 base::TimeTicks timestamp) { | 344 base::TimeTicks timestamp) { |
345 encoder_->StartFrameEncode(frame, timestamp); | 345 encoder_->StartFrameEncode(frame, timestamp); |
346 } | 346 } |
347 | 347 |
348 } // namespace content | 348 } // namespace content |
OLD | NEW |