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

Unified Diff: webrtc/video_encoder.h

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: sync Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« webrtc/video/payload_router.cc ('K') | « webrtc/video/vie_encoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video_encoder.h
diff --git a/webrtc/video_encoder.h b/webrtc/video_encoder.h
index 0100239e0a42ab8942de17373cc0bb66a991509f..e0e1f48a2789485bff14fe06837bd7d3ea8a6c8e 100644
--- a/webrtc/video_encoder.h
+++ b/webrtc/video_encoder.h
@@ -30,11 +30,43 @@ class EncodedImageCallback {
public:
virtual ~EncodedImageCallback() {}
+ struct Result {
+ enum Error {
+ OK,
+
+ // Failed to send the packet.
+ ERROR_SEND_FAILED,
+ };
+
+ Result(Error error) : error(error) {}
+ Result(Error error, uint32_t frame_id) : error(error), frame_id(frame_id) {}
+
+ Error error;
+
+ // Frame ID assigned to the frame. The frame ID should be the same as the ID
+ // seen by the receiver for this frame. RTP timestamp of the frame is used
+ // as frame ID when RTP is used to send video.
+ uint32_t frame_id = 0;
stefan-webrtc 2016/07/18 16:51:27 Default value should probably be -1, or if you pre
Sergey Ulanov 2016/07/21 00:09:40 it cannot be -1 because it's unsigned, and timesta
stefan-webrtc 2016/07/25 15:17:09 You could still use an Optional<uint32_t> or an in
+
+ // Tells the encoder that the next frame is going to be dropped.
stefan-webrtc 2016/07/18 16:51:27 Maybe "should be dropped" instead?
Sergey Ulanov 2016/07/21 00:09:39 Done.
+ bool drop_next_frame = false;
+ };
+
// Callback function which is called when an image has been encoded.
- // TODO(perkj): Change this to return void.
+ virtual Result OnEncodedImage(
+ const EncodedImage& encoded_image,
+ const CodecSpecificInfo* codec_specific_info,
+ const RTPFragmentationHeader* fragmentation) = 0;
+
+ // DEPRECATED.
+ // TODO(sergeyu): Remove this method.
virtual int32_t Encoded(const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
- const RTPFragmentationHeader* fragmentation) = 0;
+ const RTPFragmentationHeader* fragmentation) {
+ Result result =
+ OnEncodedImage(encoded_image, codec_specific_info, fragmentation);
+ return (result.error != Result::OK) ? -1 : (result.drop_next_frame ? 1 : 0);
+ }
};
class VideoEncoder {
« webrtc/video/payload_router.cc ('K') | « webrtc/video/vie_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698