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

Side by Side Diff: webrtc/media/devices/gtkvideorenderer.cc

Issue 2287233002: Delete cricket::VideoFrame::ConvertToRgbBuffer. (Closed)
Patch Set: Replace calls to ConvertFromI420 with more specific libyuv conversion. Created 4 years, 3 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 (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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
11 // Implementation of GtkVideoRenderer 11 // Implementation of GtkVideoRenderer
12 12
13 #include "webrtc/media/devices/gtkvideorenderer.h" 13 #include "webrtc/media/devices/gtkvideorenderer.h"
14 14
15 #include <gdk/gdk.h> 15 #include <gdk/gdk.h>
16 #include <glib.h> 16 #include <glib.h>
17 #include <gtk/gtk.h> 17 #include <gtk/gtk.h>
18 18
19 #include "webrtc/media/base/videocommon.h" 19 #include "libyuv/convert_argb.h"
20 #include "webrtc/media/base/videoframe.h" 20 #include "webrtc/media/base/videoframe.h"
21 21
22 namespace cricket { 22 namespace cricket {
23 23
24 class ScopedGdkLock { 24 class ScopedGdkLock {
25 public: 25 public:
26 ScopedGdkLock() { 26 ScopedGdkLock() {
27 gdk_threads_enter(); 27 gdk_threads_enter();
28 } 28 }
29 29
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 void GtkVideoRenderer::OnFrame(const VideoFrame& video_frame) { 83 void GtkVideoRenderer::OnFrame(const VideoFrame& video_frame) {
84 const VideoFrame* frame = video_frame.GetCopyWithRotationApplied(); 84 const VideoFrame* frame = video_frame.GetCopyWithRotationApplied();
85 85
86 // Need to set size as the frame might be rotated. 86 // Need to set size as the frame might be rotated.
87 if (!SetSize(frame->width(), frame->height())) { 87 if (!SetSize(frame->width(), frame->height())) {
88 return; 88 return;
89 } 89 }
90 90
91 // convert I420 frame to ABGR format, which is accepted by GTK 91 // convert I420 frame to ABGR format, which is accepted by GTK
92 frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR, 92 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
93 image_.get(), 93 frame->video_frame_buffer());
94 static_cast<size_t>(frame->width()) * 94 libyuv::I420ToARGB(buffer->DataY(), buffer->StrideY(),
95 frame->height() * 4, 95 buffer->DataU(), buffer->StrideU(),
96 frame->width() * 4); 96 buffer->DataV(), buffer->StrideV(),
97 image_.get(), frame->width() * 4,
98 buffer->width(), buffer->height());
97 99
98 ScopedGdkLock lock; 100 ScopedGdkLock lock;
99 101
100 if (IsClosed()) { 102 if (IsClosed()) {
101 return; 103 return;
102 } 104 }
103 105
104 // draw the ABGR image 106 // draw the ABGR image
105 gdk_draw_rgb_32_image(draw_area_->window, 107 gdk_draw_rgb_32_image(draw_area_->window,
106 draw_area_->style->fg_gc[GTK_STATE_NORMAL], 108 draw_area_->style->fg_gc[GTK_STATE_NORMAL],
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 151 }
150 152
151 if (!GTK_IS_WINDOW(window_) || !GTK_IS_DRAWING_AREA(draw_area_)) { 153 if (!GTK_IS_WINDOW(window_) || !GTK_IS_DRAWING_AREA(draw_area_)) {
152 return true; 154 return true;
153 } 155 }
154 156
155 return false; 157 return false;
156 } 158 }
157 159
158 } // namespace cricket 160 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698