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

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

Issue 2691373005: Support alpha channel recording for VPX in MediaRecorder (Closed)
Patch Set: Created 3 years, 9 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_RECORDER_VIDEO_TRACK_RECORDER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
6 #define CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 6 #define CONTENT_RENDERER_MEDIA_RECORDER_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #if BUILDFLAG(RTC_USE_H264) 44 #if BUILDFLAG(RTC_USE_H264)
45 H264, 45 H264,
46 #endif 46 #endif
47 LAST 47 LAST
48 }; 48 };
49 class Encoder; 49 class Encoder;
50 50
51 using OnEncodedVideoCB = 51 using OnEncodedVideoCB =
52 base::Callback<void(const media::WebmMuxer::VideoParameters& params, 52 base::Callback<void(const media::WebmMuxer::VideoParameters& params,
53 std::unique_ptr<std::string> encoded_data, 53 std::unique_ptr<std::string> encoded_data,
54 std::unique_ptr<std::string> encoded_alpha,
54 base::TimeTicks capture_timestamp, 55 base::TimeTicks capture_timestamp,
55 bool is_key_frame)>; 56 bool is_key_frame)>;
56 57
57 static CodecId GetPreferredCodecId(); 58 static CodecId GetPreferredCodecId();
58 59
59 VideoTrackRecorder(CodecId codec, 60 VideoTrackRecorder(CodecId codec,
60 const blink::WebMediaStreamTrack& track, 61 const blink::WebMediaStreamTrack& track,
61 const OnEncodedVideoCB& on_encoded_video_cb, 62 const OnEncodedVideoCB& on_encoded_video_cb,
62 int32_t bits_per_second); 63 int32_t bits_per_second);
63 ~VideoTrackRecorder() override; 64 ~VideoTrackRecorder() override;
64 65
65 void Pause(); 66 void Pause();
66 void Resume(); 67 void Resume();
67 68
68 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 69 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
69 base::TimeTicks capture_time); 70 base::TimeTicks capture_time);
70 private: 71 private:
71 friend class VideoTrackRecorderTest; 72 friend class VideoTrackRecorderTest;
72 73
73 void InitializeEncoder(CodecId codec, 74 void InitializeEncoder(CodecId codec,
74 const OnEncodedVideoCB& on_encoded_video_callback, 75 const OnEncodedVideoCB& on_encoded_video_callback,
75 int32_t bits_per_second, 76 int32_t bits_per_second,
76 const scoped_refptr<media::VideoFrame>& frame, 77 const scoped_refptr<media::VideoFrame>& frame,
77 base::TimeTicks capture_time); 78 base::TimeTicks capture_time);
78 79
80 // TODO(emircan): Remove after refactor, see http://crbug.com/700433.
81 bool CanEncodeAlphaChannelForTesting();
82
79 // Used to check that we are destroyed on the same thread we were created. 83 // Used to check that we are destroyed on the same thread we were created.
80 base::ThreadChecker main_render_thread_checker_; 84 base::ThreadChecker main_render_thread_checker_;
81 85
82 // We need to hold on to the Blink track to remove ourselves on dtor. 86 // We need to hold on to the Blink track to remove ourselves on dtor.
83 blink::WebMediaStreamTrack track_; 87 blink::WebMediaStreamTrack track_;
84 88
85 // Inner class to encode using whichever codec is configured. 89 // Inner class to encode using whichever codec is configured.
86 scoped_refptr<Encoder> encoder_; 90 scoped_refptr<Encoder> encoder_;
87 91
88 base::Callback<void(const scoped_refptr<media::VideoFrame>& frame, 92 base::Callback<void(const scoped_refptr<media::VideoFrame>& frame,
89 base::TimeTicks capture_time)> 93 base::TimeTicks capture_time)>
90 initialize_encoder_callback_; 94 initialize_encoder_callback_;
91 95
92 // Used to track the paused state during the initialization process. 96 // Used to track the paused state during the initialization process.
93 bool paused_before_init_; 97 bool paused_before_init_;
94 98
95 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; 99 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
96 100
97 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 101 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
98 }; 102 };
99 103
100 } // namespace content 104 } // namespace content
101 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 105 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698