OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 struct EncoderParameters { | 29 struct EncoderParameters { |
30 uint32_t target_bitrate; | 30 uint32_t target_bitrate; |
31 uint8_t loss_rate; | 31 uint8_t loss_rate; |
32 int64_t rtt; | 32 int64_t rtt; |
33 uint32_t input_frame_rate; | 33 uint32_t input_frame_rate; |
34 }; | 34 }; |
35 | 35 |
36 class VCMEncodedFrameCallback : public EncodedImageCallback { | 36 class VCMEncodedFrameCallback : public EncodedImageCallback { |
37 public: | 37 public: |
38 explicit VCMEncodedFrameCallback(EncodedImageCallback* post_encode_callback); | 38 VCMEncodedFrameCallback(EncodedImageCallback* post_encode_callback, |
| 39 media_optimization::MediaOptimization* media_opt); |
39 virtual ~VCMEncodedFrameCallback(); | 40 virtual ~VCMEncodedFrameCallback(); |
40 | 41 |
41 // Implements EncodedImageCallback. | 42 // Implements EncodedImageCallback. |
42 int32_t Encoded(const EncodedImage& encoded_image, | 43 int32_t Encoded(const EncodedImage& encoded_image, |
43 const CodecSpecificInfo* codec_specific, | 44 const CodecSpecificInfo* codec_specific, |
44 const RTPFragmentationHeader* fragmentation_header) override; | 45 const RTPFragmentationHeader* fragmentation_header) override; |
45 int32_t SetTransportCallback(VCMPacketizationCallback* transport); | |
46 void SetMediaOpt(media_optimization::MediaOptimization* media_opt); | |
47 void SetInternalSource(bool internal_source) { | 46 void SetInternalSource(bool internal_source) { |
48 internal_source_ = internal_source; | 47 internal_source_ = internal_source; |
49 } | 48 } |
50 void SignalLastEncoderImplementationUsed( | |
51 const char* encoder_implementation_name); | |
52 | 49 |
53 private: | 50 private: |
54 VCMPacketizationCallback* send_callback_; | |
55 media_optimization::MediaOptimization* media_opt_; | |
56 bool internal_source_; | 51 bool internal_source_; |
57 | 52 EncodedImageCallback* const post_encode_callback_; |
58 EncodedImageCallback* post_encode_callback_; | 53 media_optimization::MediaOptimization* const media_opt_; |
59 }; | 54 }; |
60 | 55 |
61 class VCMGenericEncoder { | 56 class VCMGenericEncoder { |
62 friend class VCMCodecDataBase; | 57 friend class VCMCodecDataBase; |
63 | 58 |
64 public: | 59 public: |
65 VCMGenericEncoder(VideoEncoder* encoder, | 60 VCMGenericEncoder(VideoEncoder* encoder, |
66 VideoEncoderRateObserver* rate_observer, | 61 VideoEncoderRateObserver* rate_observer, |
67 VCMEncodedFrameCallback* encoded_frame_callback, | 62 VCMEncodedFrameCallback* encoded_frame_callback, |
68 bool internal_source); | 63 bool internal_source); |
69 ~VCMGenericEncoder(); | 64 ~VCMGenericEncoder(); |
70 int32_t Release(); | 65 int32_t Release(); |
71 int32_t InitEncode(const VideoCodec* settings, | 66 int32_t InitEncode(const VideoCodec* settings, |
72 int32_t number_of_cores, | 67 int32_t number_of_cores, |
73 size_t max_payload_size); | 68 size_t max_payload_size); |
74 int32_t Encode(const VideoFrame& frame, | 69 int32_t Encode(const VideoFrame& frame, |
75 const CodecSpecificInfo* codec_specific, | 70 const CodecSpecificInfo* codec_specific, |
76 const std::vector<FrameType>& frame_types); | 71 const std::vector<FrameType>& frame_types); |
77 | 72 |
| 73 const char* ImplementationName() const; |
| 74 |
78 void SetEncoderParameters(const EncoderParameters& params); | 75 void SetEncoderParameters(const EncoderParameters& params); |
79 EncoderParameters GetEncoderParameters() const; | 76 EncoderParameters GetEncoderParameters() const; |
80 | 77 |
81 int32_t SetPeriodicKeyFrames(bool enable); | 78 int32_t SetPeriodicKeyFrames(bool enable); |
82 int32_t RequestFrame(const std::vector<FrameType>& frame_types); | 79 int32_t RequestFrame(const std::vector<FrameType>& frame_types); |
83 bool InternalSource() const; | 80 bool InternalSource() const; |
84 void OnDroppedFrame(); | 81 void OnDroppedFrame(); |
85 bool SupportsNativeHandle() const; | 82 bool SupportsNativeHandle() const; |
86 | 83 |
87 private: | 84 private: |
88 VideoEncoder* const encoder_; | 85 VideoEncoder* const encoder_; |
89 VideoEncoderRateObserver* const rate_observer_; | 86 VideoEncoderRateObserver* const rate_observer_; |
90 VCMEncodedFrameCallback* const vcm_encoded_frame_callback_; | 87 VCMEncodedFrameCallback* const vcm_encoded_frame_callback_; |
91 const bool internal_source_; | 88 const bool internal_source_; |
92 rtc::CriticalSection params_lock_; | 89 rtc::CriticalSection params_lock_; |
93 EncoderParameters encoder_params_ GUARDED_BY(params_lock_); | 90 EncoderParameters encoder_params_ GUARDED_BY(params_lock_); |
94 bool is_screenshare_; | 91 bool is_screenshare_; |
95 }; | 92 }; |
96 | 93 |
97 } // namespace webrtc | 94 } // namespace webrtc |
98 | 95 |
99 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ | 96 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ |
OLD | NEW |