OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
11 #ifndef WEBRTC_VIDEO_ENCODER_H_ | 11 #ifndef WEBRTC_VIDEO_ENCODER_H_ |
12 #define WEBRTC_VIDEO_ENCODER_H_ | 12 #define WEBRTC_VIDEO_ENCODER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
| 18 #include "webrtc/base/checks.h" |
18 #include "webrtc/common_types.h" | 19 #include "webrtc/common_types.h" |
19 #include "webrtc/typedefs.h" | 20 #include "webrtc/typedefs.h" |
20 #include "webrtc/video_frame.h" | 21 #include "webrtc/video_frame.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 class RTPFragmentationHeader; | 25 class RTPFragmentationHeader; |
25 // TODO(pbos): Expose these through a public (root) header or change these APIs. | 26 // TODO(pbos): Expose these through a public (root) header or change these APIs. |
26 struct CodecSpecificInfo; | 27 struct CodecSpecificInfo; |
27 class VideoCodec; | 28 class VideoCodec; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // <0 - Errors: WEBRTC_VIDEO_CODEC_ERROR | 142 // <0 - Errors: WEBRTC_VIDEO_CODEC_ERROR |
142 virtual int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) = 0; | 143 virtual int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) = 0; |
143 | 144 |
144 // Inform the encoder about the new target bit rate. | 145 // Inform the encoder about the new target bit rate. |
145 // | 146 // |
146 // Input: | 147 // Input: |
147 // - bitrate : New target bit rate | 148 // - bitrate : New target bit rate |
148 // - framerate : The target frame rate | 149 // - framerate : The target frame rate |
149 // | 150 // |
150 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. | 151 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. |
151 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; | 152 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) { |
| 153 RTC_NOTREACHED() << "SetRate(uint32_t, uint32_t) is deprecated."; |
| 154 return -1; |
| 155 } |
| 156 |
| 157 // Default fallback: Just use the sum of bitrates as the single target rate. |
| 158 // TODO(sprang): Remove this default implementation when we remove SetRates(). |
| 159 virtual int32_t SetRateAllocation(const BitrateAllocation& allocation, |
| 160 uint32_t framerate) { |
| 161 return SetRates(allocation.get_sum_kbps(), framerate); |
| 162 } |
152 | 163 |
153 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } | 164 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } |
154 virtual void OnDroppedFrame() {} | 165 virtual void OnDroppedFrame() {} |
155 virtual bool SupportsNativeHandle() const { return false; } | 166 virtual bool SupportsNativeHandle() const { return false; } |
156 virtual const char* ImplementationName() const { return "unknown"; } | 167 virtual const char* ImplementationName() const { return "unknown"; } |
157 }; | 168 }; |
158 | 169 |
159 } // namespace webrtc | 170 } // namespace webrtc |
160 #endif // WEBRTC_VIDEO_ENCODER_H_ | 171 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |