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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // seen by the receiver for this frame. RTP timestamp of the frame is used | 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 | 48 // as frame ID when RTP is used to send video. Must be used only when |
49 // error=OK. | 49 // error=OK. |
50 uint32_t frame_id = 0; | 50 uint32_t frame_id = 0; |
51 | 51 |
52 // Tells the encoder that the next frame is should be dropped. | 52 // Tells the encoder that the next frame is should be dropped. |
53 bool drop_next_frame = false; | 53 bool drop_next_frame = false; |
54 }; | 54 }; |
55 | 55 |
56 // Callback function which is called when an image has been encoded. | 56 // Callback function which is called when an image has been encoded. |
57 virtual Result OnEncodedImage(const EncodedImage& encoded_image, | 57 virtual Result OnEncodedImage( |
58 const CodecSpecificInfo* codec_specific_info, | 58 const EncodedImage& encoded_image, |
59 const RTPFragmentationHeader* fragmentation) { | 59 const CodecSpecificInfo* codec_specific_info, |
60 return (Encoded(encoded_image, codec_specific_info, fragmentation) == 0) | 60 const RTPFragmentationHeader* fragmentation) = 0; |
61 ? Result(Result::OK, 0) | |
62 : Result(Result::ERROR_SEND_FAILED); | |
63 } | |
64 | |
65 // DEPRECATED. | |
66 // TODO(sergeyu): Remove this method. | |
67 virtual int32_t Encoded(const EncodedImage& encoded_image, | |
68 const CodecSpecificInfo* codec_specific_info, | |
69 const RTPFragmentationHeader* fragmentation) { | |
70 Result result = | |
71 OnEncodedImage(encoded_image, codec_specific_info, fragmentation); | |
72 return (result.error != Result::OK) ? -1 : (result.drop_next_frame ? 1 : 0); | |
73 } | |
74 }; | 61 }; |
75 | 62 |
76 class VideoEncoder { | 63 class VideoEncoder { |
77 public: | 64 public: |
78 enum EncoderType { | 65 enum EncoderType { |
79 kH264, | 66 kH264, |
80 kVp8, | 67 kVp8, |
81 kVp9, | 68 kVp9, |
82 kUnsupportedCodec, | 69 kUnsupportedCodec, |
83 }; | 70 }; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 202 |
216 const EncoderType encoder_type_; | 203 const EncoderType encoder_type_; |
217 webrtc::VideoEncoder* const encoder_; | 204 webrtc::VideoEncoder* const encoder_; |
218 | 205 |
219 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; | 206 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; |
220 std::string fallback_implementation_name_; | 207 std::string fallback_implementation_name_; |
221 EncodedImageCallback* callback_; | 208 EncodedImageCallback* callback_; |
222 }; | 209 }; |
223 } // namespace webrtc | 210 } // namespace webrtc |
224 #endif // WEBRTC_VIDEO_ENCODER_H_ | 211 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |