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( | 57 virtual Result OnEncodedImage(const EncodedImage& encoded_image, |
58 const EncodedImage& encoded_image, | 58 const CodecSpecificInfo* codec_specific_info, |
59 const CodecSpecificInfo* codec_specific_info, | 59 const RTPFragmentationHeader* fragmentation) { |
60 const RTPFragmentationHeader* fragmentation) = 0; | 60 return (Encoded(encoded_image, codec_specific_info, 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 } |
61 }; | 74 }; |
62 | 75 |
63 class VideoEncoder { | 76 class VideoEncoder { |
64 public: | 77 public: |
65 enum EncoderType { | 78 enum EncoderType { |
66 kH264, | 79 kH264, |
67 kVp8, | 80 kVp8, |
68 kVp9, | 81 kVp9, |
69 kUnsupportedCodec, | 82 kUnsupportedCodec, |
70 }; | 83 }; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 215 |
203 const EncoderType encoder_type_; | 216 const EncoderType encoder_type_; |
204 webrtc::VideoEncoder* const encoder_; | 217 webrtc::VideoEncoder* const encoder_; |
205 | 218 |
206 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; | 219 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; |
207 std::string fallback_implementation_name_; | 220 std::string fallback_implementation_name_; |
208 EncodedImageCallback* callback_; | 221 EncodedImageCallback* callback_; |
209 }; | 222 }; |
210 } // namespace webrtc | 223 } // namespace webrtc |
211 #endif // WEBRTC_VIDEO_ENCODER_H_ | 224 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |