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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // MediaStreamVideo* classes that are constructed/configured on Main Render | 34 // MediaStreamVideo* classes that are constructed/configured on Main Render |
35 // thread but that pass frames on Render IO thread. It has an internal Encoder | 35 // thread but that pass frames on Render IO thread. It has an internal Encoder |
36 // with its own threading subtleties, see the implementation file. | 36 // with its own threading subtleties, see the implementation file. |
37 class CONTENT_EXPORT VideoTrackRecorder | 37 class CONTENT_EXPORT VideoTrackRecorder |
38 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { | 38 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { |
39 public: | 39 public: |
40 enum class CodecId { | 40 enum class CodecId { |
41 VP8, | 41 VP8, |
42 VP9, | 42 VP9, |
43 H264, | 43 H264, |
| 44 LAST |
44 }; | 45 }; |
45 class Encoder; | 46 class Encoder; |
46 | 47 |
47 using OnEncodedVideoCB = | 48 using OnEncodedVideoCB = |
48 base::Callback<void(const media::WebmMuxer::VideoParameters& params, | 49 base::Callback<void(const media::WebmMuxer::VideoParameters& params, |
49 std::unique_ptr<std::string> encoded_data, | 50 std::unique_ptr<std::string> encoded_data, |
50 base::TimeTicks capture_timestamp, | 51 base::TimeTicks capture_timestamp, |
51 bool is_key_frame)>; | 52 bool is_key_frame)>; |
52 | 53 |
| 54 static CodecId GetPreferredCodec(); |
| 55 |
53 VideoTrackRecorder(CodecId codec, | 56 VideoTrackRecorder(CodecId codec, |
54 const blink::WebMediaStreamTrack& track, | 57 const blink::WebMediaStreamTrack& track, |
55 const OnEncodedVideoCB& on_encoded_video_cb, | 58 const OnEncodedVideoCB& on_encoded_video_cb, |
56 int32_t bits_per_second); | 59 int32_t bits_per_second); |
57 ~VideoTrackRecorder() override; | 60 ~VideoTrackRecorder() override; |
58 | 61 |
59 void Pause(); | 62 void Pause(); |
60 void Resume(); | 63 void Resume(); |
61 | 64 |
62 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, | 65 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, |
(...skipping 23 matching lines...) Expand all Loading... |
86 // Used to track the paused state during the initialization process. | 89 // Used to track the paused state during the initialization process. |
87 bool paused_before_init_; | 90 bool paused_before_init_; |
88 | 91 |
89 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; | 92 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; |
90 | 93 |
91 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); | 94 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); |
92 }; | 95 }; |
93 | 96 |
94 } // namespace content | 97 } // namespace content |
95 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 98 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
OLD | NEW |