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. Must be used only when | |
49 // error=OK. | |
50 uint32_t frame_id = 0; | |
51 | |
52 // Tells the encoder that the next frame is should be dropped. | |
53 bool drop_next_frame = false; | |
54 }; | |
55 | |
56 // Callback function which is called when an image has been encoded. | 33 // Callback function which is called when an image has been encoded. |
57 virtual Result OnEncodedImage( | 34 // TODO(perkj): Change this to return void. |
58 const EncodedImage& encoded_image, | |
59 const CodecSpecificInfo* codec_specific_info, | |
60 const RTPFragmentationHeader* fragmentation) = 0; | |
61 | |
62 // DEPRECATED. | |
63 // TODO(sergeyu): Remove this method. | |
64 virtual int32_t Encoded(const EncodedImage& encoded_image, | 35 virtual int32_t Encoded(const EncodedImage& encoded_image, |
65 const CodecSpecificInfo* codec_specific_info, | 36 const CodecSpecificInfo* codec_specific_info, |
66 const RTPFragmentationHeader* fragmentation) { | 37 const RTPFragmentationHeader* fragmentation) = 0; |
67 Result result = | |
68 OnEncodedImage(encoded_image, codec_specific_info, fragmentation); | |
69 return (result.error != Result::OK) ? -1 : (result.drop_next_frame ? 1 : 0); | |
70 } | |
71 }; | 38 }; |
72 | 39 |
73 class VideoEncoder { | 40 class VideoEncoder { |
74 public: | 41 public: |
75 enum EncoderType { | 42 enum EncoderType { |
76 kH264, | 43 kH264, |
77 kVp8, | 44 kVp8, |
78 kVp9, | 45 kVp9, |
79 kUnsupportedCodec, | 46 kUnsupportedCodec, |
80 }; | 47 }; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 176 |
210 const EncoderType encoder_type_; | 177 const EncoderType encoder_type_; |
211 webrtc::VideoEncoder* const encoder_; | 178 webrtc::VideoEncoder* const encoder_; |
212 | 179 |
213 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; | 180 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; |
214 std::string fallback_implementation_name_; | 181 std::string fallback_implementation_name_; |
215 EncodedImageCallback* callback_; | 182 EncodedImageCallback* callback_; |
216 }; | 183 }; |
217 } // namespace webrtc | 184 } // namespace webrtc |
218 #endif // WEBRTC_VIDEO_ENCODER_H_ | 185 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |