From 2f67b82e208552ce6aa5bd7d51cc67898a3bca9b Mon Sep 17 00:00:00 2001 From: mbonadei Date: Wed, 18 Jan 2017 04:23:10 -0800 Subject: [PATCH] Fixing peerconnection reddish video issue BUG=webrtc:6857 NOTRY=True Review-Url: https://codereview.webrtc.org/2604323002 Cr-Commit-Position: refs/heads/master@{#16143} --- webrtc/examples/peerconnection/client/linux/main_wnd.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.cc b/webrtc/examples/peerconnection/client/linux/main_wnd.cc index 3070719b64..067dde97e1 100644 --- a/webrtc/examples/peerconnection/client/linux/main_wnd.cc +++ b/webrtc/examples/peerconnection/client/linux/main_wnd.cc @@ -531,7 +531,13 @@ void GtkMainWnd::VideoRenderer::OnFrame( } SetSize(buffer->width(), buffer->height()); - libyuv::I420ToRGBA(buffer->DataY(), buffer->StrideY(), + // The order in the name of libyuv::I420To(ABGR,RGBA) is ambiguous because + // it doesn't tell you if it is referring to how it is laid out in memory as + // bytes or if endiannes is taken into account. + // This was supposed to be a call to libyuv::I420ToRGBA but it was resulting + // in a reddish video output (see https://bugs.webrtc.org/6857) because it + // was producing an unexpected byte order (ABGR, byte swapped). + libyuv::I420ToABGR(buffer->DataY(), buffer->StrideY(), buffer->DataU(), buffer->StrideU(), buffer->DataV(), buffer->StrideV(), image_.get(), width_ * 4,