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