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

Unified Diff: webrtc/examples/peerconnection/client/linux/main_wnd.cc

Issue 2287233002: Delete cricket::VideoFrame::ConvertToRgbBuffer. (Closed)
Patch Set: Replace calls to ConvertFromI420 with more specific libyuv conversion. Created 4 years, 4 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/examples/BUILD.gn ('k') | webrtc/examples/peerconnection/client/main_wnd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « webrtc/examples/BUILD.gn ('k') | webrtc/examples/peerconnection/client/main_wnd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698