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

Unified Diff: webrtc/modules/video_coding/main/source/video_sender.cc

Issue 1158273010: Re-land "Convert native handles to buffers before encoding." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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
« no previous file with comments | « webrtc/modules/video_coding/main/source/generic_encoder.cc ('k') | webrtc/test/fake_texture_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/main/source/video_sender.cc
diff --git a/webrtc/modules/video_coding/main/source/video_sender.cc b/webrtc/modules/video_coding/main/source/video_sender.cc
index 5da529f7ed19fefec0dbdbde48c7fcec72c6aadd..9b855da16a4cfc6402795770a7205455cc4a69e6 100644
--- a/webrtc/modules/video_coding/main/source/video_sender.cc
+++ b/webrtc/modules/video_coding/main/source/video_sender.cc
@@ -321,8 +321,16 @@ int32_t VideoSender::AddVideoFrame(const VideoFrame& videoFrame,
LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping.";
return VCM_PARAMETER_ERROR;
}
+ VideoFrame converted_frame = videoFrame;
+ if (converted_frame.native_handle() && !_encoder->SupportsNativeHandle()) {
+ // This module only supports software encoding.
+ // TODO(pbos): Offload conversion from the encoder thread.
+ converted_frame = converted_frame.ConvertNativeToI420Frame();
+ CHECK(!converted_frame.IsZeroSize())
+ << "Frame conversion failed, won't be able to encode frame.";
+ }
int32_t ret =
- _encoder->Encode(videoFrame, codecSpecificInfo, _nextFrameTypes);
+ _encoder->Encode(converted_frame, codecSpecificInfo, _nextFrameTypes);
if (ret < 0) {
LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret;
return ret;
« no previous file with comments | « webrtc/modules/video_coding/main/source/generic_encoder.cc ('k') | webrtc/test/fake_texture_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698