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

Side by Side Diff: webrtc/examples/peerconnection/client/linux/main_wnd.cc

Issue 1838353004: cricket::VideoFrame cleanup. New width() and height(). Deleted GetChroma* methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix int vs size_t comparison. Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 image_.reset(new uint8_t[width * height * 4]); 479 image_.reset(new uint8_t[width * height * 4]);
480 gdk_threads_leave(); 480 gdk_threads_leave();
481 } 481 }
482 482
483 void GtkMainWnd::VideoRenderer::OnFrame( 483 void GtkMainWnd::VideoRenderer::OnFrame(
484 const cricket::VideoFrame& video_frame) { 484 const cricket::VideoFrame& video_frame) {
485 gdk_threads_enter(); 485 gdk_threads_enter();
486 486
487 const cricket::VideoFrame* frame = video_frame.GetCopyWithRotationApplied(); 487 const cricket::VideoFrame* frame = video_frame.GetCopyWithRotationApplied();
488 488
489 SetSize(static_cast<int>(frame->GetWidth()), 489 SetSize(frame->width(), frame->height());
490 static_cast<int>(frame->GetHeight()));
491 490
492 int size = width_ * height_ * 4; 491 int size = width_ * height_ * 4;
493 // TODO(henrike): Convert directly to RGBA 492 // TODO(henrike): Convert directly to RGBA
494 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, 493 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB,
495 image_.get(), 494 image_.get(),
496 size, 495 size,
497 width_ * 4); 496 width_ * 4);
498 // Convert the B,G,R,A frame to R,G,B,A, which is accepted by GTK. 497 // Convert the B,G,R,A frame to R,G,B,A, which is accepted by GTK.
499 // The 'A' is just padding for GTK, so we can use it as temp. 498 // The 'A' is just padding for GTK, so we can use it as temp.
500 uint8_t* pix = image_.get(); 499 uint8_t* pix = image_.get();
501 uint8_t* end = image_.get() + size; 500 uint8_t* end = image_.get() + size;
502 while (pix < end) { 501 while (pix < end) {
503 pix[3] = pix[0]; // Save B to A. 502 pix[3] = pix[0]; // Save B to A.
504 pix[0] = pix[2]; // Set Red. 503 pix[0] = pix[2]; // Set Red.
505 pix[2] = pix[3]; // Set Blue. 504 pix[2] = pix[3]; // Set Blue.
506 pix[3] = 0xFF; // Fixed Alpha. 505 pix[3] = 0xFF; // Fixed Alpha.
507 pix += 4; 506 pix += 4;
508 } 507 }
509 508
510 gdk_threads_leave(); 509 gdk_threads_leave();
511 510
512 g_idle_add(Redraw, main_wnd_); 511 g_idle_add(Redraw, main_wnd_);
513 } 512 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698