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

Side by Side Diff: webrtc/video_encoder.h

Issue 2203233002: Revert of Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « webrtc/video/vie_encoder.cc ('k') | webrtc/voice_engine/channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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(const EncodedImage& encoded_image, 34 // TODO(perkj): Change this to return void.
58 const CodecSpecificInfo* codec_specific_info,
59 const RTPFragmentationHeader* fragmentation) {
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, 35 virtual int32_t Encoded(const EncodedImage& encoded_image,
68 const CodecSpecificInfo* codec_specific_info, 36 const CodecSpecificInfo* codec_specific_info,
69 const RTPFragmentationHeader* fragmentation) { 37 const RTPFragmentationHeader* fragmentation) = 0;
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 }; 38 };
75 39
76 class VideoEncoder { 40 class VideoEncoder {
77 public: 41 public:
78 enum EncoderType { 42 enum EncoderType {
79 kH264, 43 kH264,
80 kVp8, 44 kVp8,
81 kVp9, 45 kVp9,
82 kUnsupportedCodec, 46 kUnsupportedCodec,
83 }; 47 };
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 176
213 const EncoderType encoder_type_; 177 const EncoderType encoder_type_;
214 webrtc::VideoEncoder* const encoder_; 178 webrtc::VideoEncoder* const encoder_;
215 179
216 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; 180 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
217 std::string fallback_implementation_name_; 181 std::string fallback_implementation_name_;
218 EncodedImageCallback* callback_; 182 EncodedImageCallback* callback_;
219 }; 183 };
220 } // namespace webrtc 184 } // namespace webrtc
221 #endif // WEBRTC_VIDEO_ENCODER_H_ 185 #endif // WEBRTC_VIDEO_ENCODER_H_
OLDNEW
« no previous file with comments | « webrtc/video/vie_encoder.cc ('k') | webrtc/voice_engine/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698