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

Side by Side Diff: media/cast/sender/external_video_encoder.h

Issue 2133223003: Revert of Refactoring: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « media/cast/sender/audio_sender_unittest.cc ('k') | media/cast/sender/external_video_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_ 5 #ifndef MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
6 #define MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_ 6 #define MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 10 matching lines...) Expand all
21 namespace media { 21 namespace media {
22 namespace cast { 22 namespace cast {
23 23
24 // Cast MAIN thread proxy to the internal media::VideoEncodeAccelerator 24 // Cast MAIN thread proxy to the internal media::VideoEncodeAccelerator
25 // implementation running on a separate thread. Encodes media::VideoFrames and 25 // implementation running on a separate thread. Encodes media::VideoFrames and
26 // emits media::cast::EncodedFrames. 26 // emits media::cast::EncodedFrames.
27 class ExternalVideoEncoder : public VideoEncoder { 27 class ExternalVideoEncoder : public VideoEncoder {
28 public: 28 public:
29 // Returns true if the current platform and system configuration supports 29 // Returns true if the current platform and system configuration supports
30 // using ExternalVideoEncoder with the given |video_config|. 30 // using ExternalVideoEncoder with the given |video_config|.
31 static bool IsSupported(const FrameSenderConfig& video_config); 31 static bool IsSupported(const VideoSenderConfig& video_config);
32 32
33 ExternalVideoEncoder( 33 ExternalVideoEncoder(
34 const scoped_refptr<CastEnvironment>& cast_environment, 34 const scoped_refptr<CastEnvironment>& cast_environment,
35 const FrameSenderConfig& video_config, 35 const VideoSenderConfig& video_config,
36 const gfx::Size& frame_size, 36 const gfx::Size& frame_size,
37 FrameId first_frame_id, 37 FrameId first_frame_id,
38 const StatusChangeCallback& status_change_cb, 38 const StatusChangeCallback& status_change_cb,
39 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 39 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
40 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb); 40 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb);
41 41
42 ~ExternalVideoEncoder() final; 42 ~ExternalVideoEncoder() final;
43 43
44 // VideoEncoder implementation. 44 // VideoEncoder implementation.
45 bool EncodeVideoFrame( 45 bool EncodeVideoFrame(
46 const scoped_refptr<media::VideoFrame>& video_frame, 46 const scoped_refptr<media::VideoFrame>& video_frame,
47 const base::TimeTicks& reference_time, 47 const base::TimeTicks& reference_time,
48 const FrameEncodedCallback& frame_encoded_callback) final; 48 const FrameEncodedCallback& frame_encoded_callback) final;
49 void SetBitRate(int new_bit_rate) final; 49 void SetBitRate(int new_bit_rate) final;
50 void GenerateKeyFrame() final; 50 void GenerateKeyFrame() final;
51 51
52 private: 52 private:
53 class VEAClientImpl; 53 class VEAClientImpl;
54 54
55 // Method invoked by the CreateVideoEncodeAcceleratorCallback to construct a 55 // Method invoked by the CreateVideoEncodeAcceleratorCallback to construct a
56 // VEAClientImpl to own and interface with a new |vea|. Upon return, 56 // VEAClientImpl to own and interface with a new |vea|. Upon return,
57 // |client_| holds a reference to the new VEAClientImpl. 57 // |client_| holds a reference to the new VEAClientImpl.
58 void OnCreateVideoEncodeAccelerator( 58 void OnCreateVideoEncodeAccelerator(
59 const FrameSenderConfig& video_config, 59 const VideoSenderConfig& video_config,
60 FrameId first_frame_id, 60 FrameId first_frame_id,
61 const StatusChangeCallback& status_change_cb, 61 const StatusChangeCallback& status_change_cb,
62 scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner, 62 scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner,
63 std::unique_ptr<media::VideoEncodeAccelerator> vea); 63 std::unique_ptr<media::VideoEncodeAccelerator> vea);
64 64
65 const scoped_refptr<CastEnvironment> cast_environment_; 65 const scoped_refptr<CastEnvironment> cast_environment_;
66 const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_; 66 const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_;
67 67
68 // The size of the visible region of the video frames to be encoded. 68 // The size of the visible region of the video frames to be encoded.
69 const gfx::Size frame_size_; 69 const gfx::Size frame_size_;
70 70
71 int bit_rate_; 71 int bit_rate_;
72 bool key_frame_requested_; 72 bool key_frame_requested_;
73 73
74 scoped_refptr<VEAClientImpl> client_; 74 scoped_refptr<VEAClientImpl> client_;
75 75
76 // Provides a weak pointer for the OnCreateVideoEncoderAccelerator() callback. 76 // Provides a weak pointer for the OnCreateVideoEncoderAccelerator() callback.
77 // NOTE: Weak pointers must be invalidated before all other member variables. 77 // NOTE: Weak pointers must be invalidated before all other member variables.
78 base::WeakPtrFactory<ExternalVideoEncoder> weak_factory_; 78 base::WeakPtrFactory<ExternalVideoEncoder> weak_factory_;
79 79
80 DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoder); 80 DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoder);
81 }; 81 };
82 82
83 // An implementation of SizeAdaptableVideoEncoderBase to proxy for 83 // An implementation of SizeAdaptableVideoEncoderBase to proxy for
84 // ExternalVideoEncoder instances. 84 // ExternalVideoEncoder instances.
85 class SizeAdaptableExternalVideoEncoder : public SizeAdaptableVideoEncoderBase { 85 class SizeAdaptableExternalVideoEncoder : public SizeAdaptableVideoEncoderBase {
86 public: 86 public:
87 SizeAdaptableExternalVideoEncoder( 87 SizeAdaptableExternalVideoEncoder(
88 const scoped_refptr<CastEnvironment>& cast_environment, 88 const scoped_refptr<CastEnvironment>& cast_environment,
89 const FrameSenderConfig& video_config, 89 const VideoSenderConfig& video_config,
90 const StatusChangeCallback& status_change_cb, 90 const StatusChangeCallback& status_change_cb,
91 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 91 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
92 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb); 92 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb);
93 93
94 ~SizeAdaptableExternalVideoEncoder() final; 94 ~SizeAdaptableExternalVideoEncoder() final;
95 95
96 protected: 96 protected:
97 std::unique_ptr<VideoEncoder> CreateEncoder() final; 97 std::unique_ptr<VideoEncoder> CreateEncoder() final;
98 98
99 private: 99 private:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 std::unique_ptr<uint8_t[]> last_frame_pixel_buffer_; 157 std::unique_ptr<uint8_t[]> last_frame_pixel_buffer_;
158 gfx::Size last_frame_size_; 158 gfx::Size last_frame_size_;
159 159
160 DISALLOW_COPY_AND_ASSIGN(QuantizerEstimator); 160 DISALLOW_COPY_AND_ASSIGN(QuantizerEstimator);
161 }; 161 };
162 162
163 } // namespace cast 163 } // namespace cast
164 } // namespace media 164 } // namespace media
165 165
166 #endif // MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_ 166 #endif // MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
OLDNEW
« no previous file with comments | « media/cast/sender/audio_sender_unittest.cc ('k') | media/cast/sender/external_video_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698