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 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 class RTPFragmentationHeader; | 24 class RTPFragmentationHeader; |
25 // TODO(pbos): Expose these through a public (root) header or change these APIs. | 25 // TODO(pbos): Expose these through a public (root) header or change these APIs. |
26 struct CodecSpecificInfo; | 26 struct CodecSpecificInfo; |
27 struct VideoCodec; | 27 struct VideoCodec; |
28 | 28 |
29 class EncodedImageCallback { | 29 class EncodedImageCallback { |
30 public: | 30 public: |
31 virtual ~EncodedImageCallback() {} | 31 virtual ~EncodedImageCallback() {} |
32 | 32 |
33 struct Result { | |
34 enum Error { | |
35 OK, | |
36 | |
37 // Failed to send the packet. | |
38 ERROR_SEND_FAILED, | |
39 }; | |
40 | |
41 Result(Error error) : error(error) {} | |
42 Result(Error error, uint32_t frame_id) : error(error), frame_id(frame_id) {} | |
43 | |
44 Error error; | |
45 | |
46 // Frame ID assigned to the frame. The frame ID should be the same as the ID | |
47 // seen by the receiver for this frame. RTP timestamp of the frame is used | |
48 // as frame ID when RTP is used to send video. | |
49 uint32_t frame_id = 0; | |
stefan-webrtc
2016/07/18 16:51:27
Default value should probably be -1, or if you pre
Sergey Ulanov
2016/07/21 00:09:40
it cannot be -1 because it's unsigned, and timesta
stefan-webrtc
2016/07/25 15:17:09
You could still use an Optional<uint32_t> or an in
| |
50 | |
51 // Tells the encoder that the next frame is going to be dropped. | |
stefan-webrtc
2016/07/18 16:51:27
Maybe "should be dropped" instead?
Sergey Ulanov
2016/07/21 00:09:39
Done.
| |
52 bool drop_next_frame = false; | |
53 }; | |
54 | |
33 // Callback function which is called when an image has been encoded. | 55 // Callback function which is called when an image has been encoded. |
34 // TODO(perkj): Change this to return void. | 56 virtual Result OnEncodedImage( |
57 const EncodedImage& encoded_image, | |
58 const CodecSpecificInfo* codec_specific_info, | |
59 const RTPFragmentationHeader* fragmentation) = 0; | |
60 | |
61 // DEPRECATED. | |
62 // TODO(sergeyu): Remove this method. | |
35 virtual int32_t Encoded(const EncodedImage& encoded_image, | 63 virtual int32_t Encoded(const EncodedImage& encoded_image, |
36 const CodecSpecificInfo* codec_specific_info, | 64 const CodecSpecificInfo* codec_specific_info, |
37 const RTPFragmentationHeader* fragmentation) = 0; | 65 const RTPFragmentationHeader* fragmentation) { |
66 Result result = | |
67 OnEncodedImage(encoded_image, codec_specific_info, fragmentation); | |
68 return (result.error != Result::OK) ? -1 : (result.drop_next_frame ? 1 : 0); | |
69 } | |
38 }; | 70 }; |
39 | 71 |
40 class VideoEncoder { | 72 class VideoEncoder { |
41 public: | 73 public: |
42 enum EncoderType { | 74 enum EncoderType { |
43 kH264, | 75 kH264, |
44 kVp8, | 76 kVp8, |
45 kVp9, | 77 kVp9, |
46 kUnsupportedCodec, | 78 kUnsupportedCodec, |
47 }; | 79 }; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 | 208 |
177 const EncoderType encoder_type_; | 209 const EncoderType encoder_type_; |
178 webrtc::VideoEncoder* const encoder_; | 210 webrtc::VideoEncoder* const encoder_; |
179 | 211 |
180 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; | 212 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; |
181 std::string fallback_implementation_name_; | 213 std::string fallback_implementation_name_; |
182 EncodedImageCallback* callback_; | 214 EncodedImageCallback* callback_; |
183 }; | 215 }; |
184 } // namespace webrtc | 216 } // namespace webrtc |
185 #endif // WEBRTC_VIDEO_ENCODER_H_ | 217 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |