| 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 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Render thread but that pass frames on Render IO thread. | 25 // Render thread but that pass frames on Render IO thread. |
| 26 class CONTENT_EXPORT VideoTrackRecorder | 26 class CONTENT_EXPORT VideoTrackRecorder |
| 27 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { | 27 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { |
| 28 public: | 28 public: |
| 29 using OnEncodedVideoCB = | 29 using OnEncodedVideoCB = |
| 30 base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, | 30 base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, |
| 31 scoped_ptr<std::string> encoded_data, | 31 scoped_ptr<std::string> encoded_data, |
| 32 base::TimeTicks capture_timestamp, | 32 base::TimeTicks capture_timestamp, |
| 33 bool is_key_frame)>; | 33 bool is_key_frame)>; |
| 34 | 34 |
| 35 VideoTrackRecorder(const blink::WebMediaStreamTrack& track, | 35 // |use_vp9| forces using VP9, otherwise VP8 will be used by default. |
| 36 VideoTrackRecorder(bool use_vp9, |
| 37 const blink::WebMediaStreamTrack& track, |
| 36 const OnEncodedVideoCB& on_encoded_video_cb); | 38 const OnEncodedVideoCB& on_encoded_video_cb); |
| 37 ~VideoTrackRecorder() override; | 39 ~VideoTrackRecorder() override; |
| 38 | 40 |
| 39 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, | 41 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, |
| 40 base::TimeTicks capture_time); | 42 base::TimeTicks capture_time); |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 friend class VideoTrackRecorderTest; | 45 friend class VideoTrackRecorderTest; |
| 44 | 46 |
| 45 // Used to check that we are destroyed on the same thread we were created. | 47 // Used to check that we are destroyed on the same thread we were created. |
| 46 base::ThreadChecker main_render_thread_checker_; | 48 base::ThreadChecker main_render_thread_checker_; |
| 47 | 49 |
| 48 // We need to hold on to the Blink track to remove ourselves on dtor. | 50 // We need to hold on to the Blink track to remove ourselves on dtor. |
| 49 blink::WebMediaStreamTrack track_; | 51 blink::WebMediaStreamTrack track_; |
| 50 | 52 |
| 51 // Forward declaration and member of an inner class to encode using VPx. | 53 // Forward declaration and member of an inner class to encode using VPx. |
| 52 class VpxEncoder; | 54 class VpxEncoder; |
| 53 const scoped_refptr<VpxEncoder> encoder_; | 55 const scoped_refptr<VpxEncoder> encoder_; |
| 54 | 56 |
| 55 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); | 57 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 } // namespace content | 60 } // namespace content |
| 59 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 61 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
| OLD | NEW |