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

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

Issue 2287233002: Delete cricket::VideoFrame::ConvertToRgbBuffer. (Closed)
Patch Set: Convert non-linux renderers. 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 "libyuv/convert_from.h"
19 #include "webrtc/media/base/videocommon.h" 20 #include "webrtc/media/base/videocommon.h"
20 #include "webrtc/media/base/videoframe.h" 21 #include "webrtc/media/base/videoframe.h"
21 22
22 namespace cricket { 23 namespace cricket {
23 24
24 class ScopedGdkLock { 25 class ScopedGdkLock {
25 public: 26 public:
26 ScopedGdkLock() { 27 ScopedGdkLock() {
27 gdk_threads_enter(); 28 gdk_threads_enter();
28 } 29 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 void GtkVideoRenderer::OnFrame(const VideoFrame& video_frame) { 84 void GtkVideoRenderer::OnFrame(const VideoFrame& video_frame) {
84 const VideoFrame* frame = video_frame.GetCopyWithRotationApplied(); 85 const VideoFrame* frame = video_frame.GetCopyWithRotationApplied();
85 86
86 // Need to set size as the frame might be rotated. 87 // Need to set size as the frame might be rotated.
87 if (!SetSize(frame->width(), frame->height())) { 88 if (!SetSize(frame->width(), frame->height())) {
88 return; 89 return;
89 } 90 }
90 91
91 // convert I420 frame to ABGR format, which is accepted by GTK 92 // convert I420 frame to ABGR format, which is accepted by GTK
92 frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR, 93 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
93 image_.get(), 94 frame->video_frame_buffer());
94 static_cast<size_t>(frame->width()) * 95 libyuv::ConvertFromI420(buffer->DataY(), buffer->StrideY(),
95 frame->height() * 4, 96 buffer->DataU(), buffer->StrideU(),
96 frame->width() * 4); 97 buffer->DataV(), buffer->StrideV(),
98 image_.get(), frame->width() * 4,
99 buffer->width(), buffer->height(),
perkj_webrtc 2016/08/30 07:13:39 dito
100 cricket::FOURCC_ARGB);
97 101
98 ScopedGdkLock lock; 102 ScopedGdkLock lock;
99 103
100 if (IsClosed()) { 104 if (IsClosed()) {
101 return; 105 return;
102 } 106 }
103 107
104 // draw the ABGR image 108 // draw the ABGR image
105 gdk_draw_rgb_32_image(draw_area_->window, 109 gdk_draw_rgb_32_image(draw_area_->window,
106 draw_area_->style->fg_gc[GTK_STATE_NORMAL], 110 draw_area_->style->fg_gc[GTK_STATE_NORMAL],
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 153 }
150 154
151 if (!GTK_IS_WINDOW(window_) || !GTK_IS_DRAWING_AREA(draw_area_)) { 155 if (!GTK_IS_WINDOW(window_) || !GTK_IS_DRAWING_AREA(draw_area_)) {
152 return true; 156 return true;
153 } 157 }
154 158
155 return false; 159 return false;
156 } 160 }
157 161
158 } // namespace cricket 162 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698