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 17 matching lines...) Expand all Loading... |
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 // |use_vp9| forces using VP9, otherwise VP8 will be used by default. | 35 // |use_vp9| forces using VP9, otherwise VP8 will be used by default. |
36 VideoTrackRecorder(bool use_vp9, | 36 VideoTrackRecorder(bool use_vp9, |
37 const blink::WebMediaStreamTrack& track, | 37 const blink::WebMediaStreamTrack& track, |
38 const OnEncodedVideoCB& on_encoded_video_cb); | 38 const OnEncodedVideoCB& on_encoded_video_cb, |
| 39 int32_t bits_per_second); |
39 ~VideoTrackRecorder() override; | 40 ~VideoTrackRecorder() override; |
40 | 41 |
41 void Pause(); | 42 void Pause(); |
42 void Resume(); | 43 void Resume(); |
43 | 44 |
44 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, | 45 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, |
45 base::TimeTicks capture_time); | 46 base::TimeTicks capture_time); |
46 private: | 47 private: |
47 friend class VideoTrackRecorderTest; | 48 friend class VideoTrackRecorderTest; |
48 | 49 |
49 // Used to check that we are destroyed on the same thread we were created. | 50 // Used to check that we are destroyed on the same thread we were created. |
50 base::ThreadChecker main_render_thread_checker_; | 51 base::ThreadChecker main_render_thread_checker_; |
51 | 52 |
52 // We need to hold on to the Blink track to remove ourselves on dtor. | 53 // We need to hold on to the Blink track to remove ourselves on dtor. |
53 blink::WebMediaStreamTrack track_; | 54 blink::WebMediaStreamTrack track_; |
54 | 55 |
55 // Forward declaration and member of an inner class to encode using VPx. | 56 // Forward declaration and member of an inner class to encode using VPx. |
56 class VpxEncoder; | 57 class VpxEncoder; |
57 const scoped_refptr<VpxEncoder> encoder_; | 58 const scoped_refptr<VpxEncoder> encoder_; |
58 | 59 |
59 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); | 60 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); |
60 }; | 61 }; |
61 | 62 |
62 } // namespace content | 63 } // namespace content |
63 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 64 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
OLD | NEW |