Chromium Code Reviews| 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/timedelta.h" | |
|
sprang_webrtc
2016/06/28 13:54:18
Is this import used?
Sergey Ulanov
2016/06/29 22:18:52
Done.
| |
| 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 struct VideoCodec; | 28 struct VideoCodec; |
| 28 | 29 |
| 29 class EncodedImageCallback { | 30 class EncodedImageCallback { |
| 30 public: | 31 public: |
| 31 virtual ~EncodedImageCallback() {} | 32 virtual ~EncodedImageCallback() {} |
| 32 | 33 |
| 34 struct Result { | |
| 35 static Result FrameDropped() { | |
| 36 Result result; | |
| 37 result.dropped = true; | |
| 38 return result; | |
| 39 } | |
| 40 | |
| 41 bool dropped = false; | |
|
sprang_webrtc
2016/06/28 13:54:18
I "dropped" the right name for this? From what I c
Sergey Ulanov
2016/06/29 22:18:53
Yes, good point. Done. For now I just added two po
| |
| 42 uint32_t frame_id = 0; | |
| 43 bool drop_next_frame = false; | |
| 44 }; | |
|
sprang_webrtc
2016/06/28 13:54:18
Please comment how frame_id and drop_next_frame sh
Sergey Ulanov
2016/06/29 22:18:53
Done.
| |
| 45 | |
| 33 // Callback function which is called when an image has been encoded. | 46 // Callback function which is called when an image has been encoded. |
| 34 // TODO(perkj): Change this to return void. | 47 virtual Result OnEncodedImage( |
| 48 const EncodedImage& encoded_image, | |
| 49 const CodecSpecificInfo* codec_specific_info, | |
| 50 const RTPFragmentationHeader* fragmentation) = 0; | |
| 51 | |
| 52 // DEPRECATED. | |
| 53 // TODO(sergeyu): Remove this method. | |
| 35 virtual int32_t Encoded(const EncodedImage& encoded_image, | 54 virtual int32_t Encoded(const EncodedImage& encoded_image, |
| 36 const CodecSpecificInfo* codec_specific_info, | 55 const CodecSpecificInfo* codec_specific_info, |
| 37 const RTPFragmentationHeader* fragmentation) = 0; | 56 const RTPFragmentationHeader* fragmentation) { |
| 57 Result result = | |
| 58 OnEncodedImage(encoded_image, codec_specific_info, fragmentation); | |
| 59 return result.dropped ? -1 : (result.drop_next_frame ? 1 : 0); | |
| 60 } | |
| 38 }; | 61 }; |
| 39 | 62 |
| 40 class VideoEncoder { | 63 class VideoEncoder { |
| 41 public: | 64 public: |
| 42 enum EncoderType { | 65 enum EncoderType { |
| 43 kH264, | 66 kH264, |
| 44 kVp8, | 67 kVp8, |
| 45 kVp9, | 68 kVp9, |
| 46 kUnsupportedCodec, | 69 kUnsupportedCodec, |
| 47 }; | 70 }; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 | 199 |
| 177 const EncoderType encoder_type_; | 200 const EncoderType encoder_type_; |
| 178 webrtc::VideoEncoder* const encoder_; | 201 webrtc::VideoEncoder* const encoder_; |
| 179 | 202 |
| 180 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; | 203 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; |
| 181 std::string fallback_implementation_name_; | 204 std::string fallback_implementation_name_; |
| 182 EncodedImageCallback* callback_; | 205 EncodedImageCallback* callback_; |
| 183 }; | 206 }; |
| 184 } // namespace webrtc | 207 } // namespace webrtc |
| 185 #endif // WEBRTC_VIDEO_ENCODER_H_ | 208 #endif // WEBRTC_VIDEO_ENCODER_H_ |
| OLD | NEW |