Index: webrtc/examples/peerconnection/client/linux/main_wnd.cc |
diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.cc b/webrtc/examples/peerconnection/client/linux/main_wnd.cc |
index e2ed0085e08fa220380606e09e83ea7b96db3ff4..b7eb08795d8a7fc28ed818cb5185ca6799ceee47 100644 |
--- a/webrtc/examples/peerconnection/client/linux/main_wnd.cc |
+++ b/webrtc/examples/peerconnection/client/linux/main_wnd.cc |
@@ -14,6 +14,8 @@ |
#include <gtk/gtk.h> |
#include <stddef.h> |
+// I420ToRGBA is declared in convert_from.h, not convert_argb.h. |
perkj_webrtc
2016/08/30 11:17:20
please remove this comment.
|
+#include "libyuv/convert_from.h" |
#include "webrtc/examples/peerconnection/client/defaults.h" |
#include "webrtc/base/common.h" |
#include "webrtc/base/logging.h" |
@@ -488,23 +490,13 @@ void GtkMainWnd::VideoRenderer::OnFrame( |
SetSize(frame->width(), frame->height()); |
- int size = width_ * height_ * 4; |
- // TODO(henrike): Convert directly to RGBA |
- frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, |
- image_.get(), |
- size, |
- width_ * 4); |
- // Convert the B,G,R,A frame to R,G,B,A, which is accepted by GTK. |
- // The 'A' is just padding for GTK, so we can use it as temp. |
- uint8_t* pix = image_.get(); |
- uint8_t* end = image_.get() + size; |
- while (pix < end) { |
- pix[3] = pix[0]; // Save B to A. |
- pix[0] = pix[2]; // Set Red. |
- pix[2] = pix[3]; // Set Blue. |
- pix[3] = 0xFF; // Fixed Alpha. |
- pix += 4; |
- } |
+ rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
+ frame->video_frame_buffer()); |
+ libyuv::I420ToRGBA(buffer->DataY(), buffer->StrideY(), |
+ buffer->DataU(), buffer->StrideU(), |
+ buffer->DataV(), buffer->StrideV(), |
+ image_.get(), width_ * 4, |
+ buffer->width(), buffer->height()); |
gdk_threads_leave(); |