Re-land "Convert native handles to buffers before encoding."

This reverts commit a67675506c9057bd9ffd4d76aae8b743343d434d.

BUG=webrtc:4081
TBR=magjed@webrtc.org

Review URL: https://codereview.webrtc.org/1158273010

Cr-Commit-Position: refs/heads/master@{#9381}
This commit is contained in:
Peter Boström
2015-06-05 11:08:03 +02:00
parent 3fbf3f8841
commit eb66e800d1
19 changed files with 211 additions and 143 deletions

View File

@ -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;