Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: webrtc/video_encoder.h

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: addressed feedback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
33 // Callback function which is called when an image has been encoded. 56 // Callback function which is called when an image has been encoded.
34 // TODO(perkj): Change this to return void. 57 virtual Result OnEncodedImage(
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.
35 virtual int32_t Encoded(const EncodedImage& encoded_image, 64 virtual int32_t Encoded(const EncodedImage& encoded_image,
36 const CodecSpecificInfo* codec_specific_info, 65 const CodecSpecificInfo* codec_specific_info,
37 const RTPFragmentationHeader* fragmentation) = 0; 66 const RTPFragmentationHeader* fragmentation) {
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 }
38 }; 71 };
39 72
40 class VideoEncoder { 73 class VideoEncoder {
41 public: 74 public:
42 enum EncoderType { 75 enum EncoderType {
43 kH264, 76 kH264,
44 kVp8, 77 kVp8,
45 kVp9, 78 kVp9,
46 kUnsupportedCodec, 79 kUnsupportedCodec,
47 }; 80 };
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 209
177 const EncoderType encoder_type_; 210 const EncoderType encoder_type_;
178 webrtc::VideoEncoder* const encoder_; 211 webrtc::VideoEncoder* const encoder_;
179 212
180 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; 213 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
181 std::string fallback_implementation_name_; 214 std::string fallback_implementation_name_;
182 EncodedImageCallback* callback_; 215 EncodedImageCallback* callback_;
183 }; 216 };
184 } // namespace webrtc 217 } // namespace webrtc
185 #endif // WEBRTC_VIDEO_ENCODER_H_ 218 #endif // WEBRTC_VIDEO_ENCODER_H_
OLDNEW
« webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h ('K') | « webrtc/video/vie_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698