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

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

Issue 2517173004: Move VideoFrame and related declarations to webrtc/api/video. (Closed)
Patch Set: Make rotation check clearer. Created 3 years, 11 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
« no previous file with comments | « webrtc/media/base/videosourcebase.h ('k') | webrtc/media/engine/fakewebrtccall.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/api/video/i420_buffer.h"
14 #include "webrtc/api/video/video_frame.h"
13 #include "webrtc/media/devices/gtkvideorenderer.h" 15 #include "webrtc/media/devices/gtkvideorenderer.h"
14 #include "webrtc/video_frame.h"
15 16
16 #include <gdk/gdk.h> 17 #include <gdk/gdk.h>
17 #include <glib.h> 18 #include <glib.h>
18 #include <gtk/gtk.h> 19 #include <gtk/gtk.h>
19 20
20 #include "libyuv/convert_argb.h" 21 #include "libyuv/convert_argb.h"
21 22
22 namespace cricket { 23 namespace cricket {
23 24
24 class ScopedGdkLock { 25 class ScopedGdkLock {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 image_.reset(new uint8_t[width * height * 4]); 76 image_.reset(new uint8_t[width * height * 4]);
76 gtk_widget_set_size_request(draw_area_, width, height); 77 gtk_widget_set_size_request(draw_area_, width, height);
77 78
78 width_ = width; 79 width_ = width;
79 height_ = height; 80 height_ = height;
80 return true; 81 return true;
81 } 82 }
82 83
83 void GtkVideoRenderer::OnFrame(const webrtc::VideoFrame& video_frame) { 84 void GtkVideoRenderer::OnFrame(const webrtc::VideoFrame& video_frame) {
84 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( 85 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
85 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(), 86 video_frame.video_frame_buffer());
86 video_frame.rotation())); 87 if (video_frame.rotation() != webrtc::kVideoRotation_0) {
88 buffer = webrtc::I420Buffer::Rotate(*buffer, video_frame.rotation());
89 }
87 90
88 // Need to set size as the frame might be rotated. 91 // Need to set size as the frame might be rotated.
89 if (!SetSize(buffer->width(), buffer->height())) { 92 if (!SetSize(buffer->width(), buffer->height())) {
90 return; 93 return;
91 } 94 }
92 95
93 // convert I420 frame to ABGR format, which is accepted by GTK 96 // convert I420 frame to ABGR format, which is accepted by GTK
94 libyuv::I420ToARGB(buffer->DataY(), buffer->StrideY(), 97 libyuv::I420ToARGB(buffer->DataY(), buffer->StrideY(),
95 buffer->DataU(), buffer->StrideU(), 98 buffer->DataU(), buffer->StrideU(),
96 buffer->DataV(), buffer->StrideV(), 99 buffer->DataV(), buffer->StrideV(),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 154 }
152 155
153 if (!GTK_IS_WINDOW(window_) || !GTK_IS_DRAWING_AREA(draw_area_)) { 156 if (!GTK_IS_WINDOW(window_) || !GTK_IS_DRAWING_AREA(draw_area_)) {
154 return true; 157 return true;
155 } 158 }
156 159
157 return false; 160 return false;
158 } 161 }
159 162
160 } // namespace cricket 163 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/videosourcebase.h ('k') | webrtc/media/engine/fakewebrtccall.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698