| OLD | NEW |
| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 width_ = width; | 516 width_ = width; |
| 517 height_ = height; | 517 height_ = height; |
| 518 image_.reset(new uint8_t[width * height * 4]); | 518 image_.reset(new uint8_t[width * height * 4]); |
| 519 gdk_threads_leave(); | 519 gdk_threads_leave(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void GtkMainWnd::VideoRenderer::OnFrame( | 522 void GtkMainWnd::VideoRenderer::OnFrame( |
| 523 const webrtc::VideoFrame& video_frame) { | 523 const webrtc::VideoFrame& video_frame) { |
| 524 gdk_threads_enter(); | 524 gdk_threads_enter(); |
| 525 | 525 |
| 526 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 526 rtc::scoped_refptr<webrtc::I420BufferInterface> buffer( |
| 527 video_frame.video_frame_buffer()); | 527 video_frame.video_frame_buffer()->ToI420()); |
| 528 if (video_frame.rotation() != webrtc::kVideoRotation_0) { | 528 if (video_frame.rotation() != webrtc::kVideoRotation_0) { |
| 529 buffer = webrtc::I420Buffer::Rotate(*buffer, video_frame.rotation()); | 529 buffer = webrtc::I420Buffer::Rotate(*buffer, video_frame.rotation()); |
| 530 } | 530 } |
| 531 SetSize(buffer->width(), buffer->height()); | 531 SetSize(buffer->width(), buffer->height()); |
| 532 | 532 |
| 533 // The order in the name of libyuv::I420To(ABGR,RGBA) is ambiguous because | 533 // The order in the name of libyuv::I420To(ABGR,RGBA) is ambiguous because |
| 534 // it doesn't tell you if it is referring to how it is laid out in memory as | 534 // it doesn't tell you if it is referring to how it is laid out in memory as |
| 535 // bytes or if endiannes is taken into account. | 535 // bytes or if endiannes is taken into account. |
| 536 // This was supposed to be a call to libyuv::I420ToRGBA but it was resulting | 536 // This was supposed to be a call to libyuv::I420ToRGBA but it was resulting |
| 537 // in a reddish video output (see https://bugs.webrtc.org/6857) because it | 537 // in a reddish video output (see https://bugs.webrtc.org/6857) because it |
| 538 // was producing an unexpected byte order (ABGR, byte swapped). | 538 // was producing an unexpected byte order (ABGR, byte swapped). |
| 539 libyuv::I420ToABGR(buffer->DataY(), buffer->StrideY(), | 539 libyuv::I420ToABGR(buffer->DataY(), buffer->StrideY(), |
| 540 buffer->DataU(), buffer->StrideU(), | 540 buffer->DataU(), buffer->StrideU(), |
| 541 buffer->DataV(), buffer->StrideV(), | 541 buffer->DataV(), buffer->StrideV(), |
| 542 image_.get(), width_ * 4, | 542 image_.get(), width_ * 4, |
| 543 buffer->width(), buffer->height()); | 543 buffer->width(), buffer->height()); |
| 544 | 544 |
| 545 gdk_threads_leave(); | 545 gdk_threads_leave(); |
| 546 | 546 |
| 547 g_idle_add(Redraw, main_wnd_); | 547 g_idle_add(Redraw, main_wnd_); |
| 548 } | 548 } |
| OLD | NEW |