Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: content/renderer/media/video_track_recorder.h

Issue 2623353004: RELAND: MediaRecorder: use VideoTrackRecorder::GetPreferredCodecId() when available (Closed)
Patch Set: Avoid H264 if !BUILDFLAG(RTC_USE_H264) Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 30
31 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames 31 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames
32 // received from a Stream Video Track. This class is constructed and used on a 32 // received from a Stream Video Track. This class is constructed and used on a
33 // single thread, namely the main Render thread. This mirrors the other 33 // single thread, namely the main Render thread. This mirrors the other
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 // Do not change the order of codecs; add new ones right before LAST.
40 enum class CodecId { 41 enum class CodecId {
41 VP8, 42 VP8,
42 VP9, 43 VP9,
44 #if BUILDFLAG(RTC_USE_H264)
43 H264, 45 H264,
46 #endif
47 LAST
44 }; 48 };
45 class Encoder; 49 class Encoder;
46 50
47 using OnEncodedVideoCB = 51 using OnEncodedVideoCB =
48 base::Callback<void(const media::WebmMuxer::VideoParameters& params, 52 base::Callback<void(const media::WebmMuxer::VideoParameters& params,
49 std::unique_ptr<std::string> encoded_data, 53 std::unique_ptr<std::string> encoded_data,
50 base::TimeTicks capture_timestamp, 54 base::TimeTicks capture_timestamp,
51 bool is_key_frame)>; 55 bool is_key_frame)>;
52 56
57 static CodecId GetPreferredCodecId();
58
53 VideoTrackRecorder(CodecId codec, 59 VideoTrackRecorder(CodecId codec,
54 const blink::WebMediaStreamTrack& track, 60 const blink::WebMediaStreamTrack& track,
55 const OnEncodedVideoCB& on_encoded_video_cb, 61 const OnEncodedVideoCB& on_encoded_video_cb,
56 int32_t bits_per_second); 62 int32_t bits_per_second);
57 ~VideoTrackRecorder() override; 63 ~VideoTrackRecorder() override;
58 64
59 void Pause(); 65 void Pause();
60 void Resume(); 66 void Resume();
61 67
62 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 68 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
(...skipping 23 matching lines...) Expand all
86 // Used to track the paused state during the initialization process. 92 // Used to track the paused state during the initialization process.
87 bool paused_before_init_; 93 bool paused_before_init_;
88 94
89 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; 95 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
90 96
91 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 97 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
92 }; 98 };
93 99
94 } // namespace content 100 } // namespace content
95 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ 101 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_recorder_handler.cc ('k') | content/renderer/media/video_track_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698