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

Side by Side Diff: media/tools/player_x11/gl_video_renderer.cc

Issue 222563002: Remove redundant I420-to-YV12 conversion in MediaStreamVideoTrack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/tools/player_x11/gl_video_renderer.h" 5 #include "media/tools/player_x11/gl_video_renderer.h"
6 6
7 #include <X11/Xutil.h> 7 #include <X11/Xutil.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 glXMakeCurrent(display_, 0, NULL); 110 glXMakeCurrent(display_, 0, NULL);
111 glXDestroyContext(display_, gl_context_); 111 glXDestroyContext(display_, gl_context_);
112 } 112 }
113 113
114 void GlVideoRenderer::Paint(media::VideoFrame* video_frame) { 114 void GlVideoRenderer::Paint(media::VideoFrame* video_frame) {
115 if (!gl_context_) 115 if (!gl_context_)
116 Initialize(video_frame->coded_size(), video_frame->visible_rect()); 116 Initialize(video_frame->coded_size(), video_frame->visible_rect());
117 117
118 // Convert YUV frame to RGB. 118 // Convert YUV frame to RGB.
119 DCHECK(video_frame->format() == media::VideoFrame::YV12 || 119 DCHECK(video_frame->format() == media::VideoFrame::YV12 ||
120 video_frame->format() == media::VideoFrame::I420 ||
120 video_frame->format() == media::VideoFrame::YV16); 121 video_frame->format() == media::VideoFrame::YV16);
121 DCHECK(video_frame->stride(media::VideoFrame::kUPlane) == 122 DCHECK(video_frame->stride(media::VideoFrame::kUPlane) ==
122 video_frame->stride(media::VideoFrame::kVPlane)); 123 video_frame->stride(media::VideoFrame::kVPlane));
123 124
124 if (glXGetCurrentContext() != gl_context_ || 125 if (glXGetCurrentContext() != gl_context_ ||
125 glXGetCurrentDrawable() != window_) { 126 glXGetCurrentDrawable() != window_) {
126 glXMakeCurrent(display_, window_, gl_context_); 127 glXMakeCurrent(display_, window_, gl_context_);
127 } 128 }
128 for (unsigned int i = 0; i < kNumYUVPlanes; ++i) { 129 for (unsigned int i = 0; i < kNumYUVPlanes; ++i) {
129 unsigned int width = video_frame->stride(i); 130 unsigned int width = video_frame->stride(i);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 verts[0] = x0; verts[1] = y0; 241 verts[0] = x0; verts[1] = y0;
241 verts[2] = x0; verts[3] = y1; 242 verts[2] = x0; verts[3] = y1;
242 verts[4] = x1; verts[5] = y0; 243 verts[4] = x1; verts[5] = y0;
243 verts[6] = x1; verts[7] = y1; 244 verts[6] = x1; verts[7] = y1;
244 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, verts); 245 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, verts);
245 246
246 // We are getting called on a thread. Release the context so that it can be 247 // We are getting called on a thread. Release the context so that it can be
247 // made current on the main thread. 248 // made current on the main thread.
248 glXMakeCurrent(display_, 0, NULL); 249 glXMakeCurrent(display_, 0, NULL);
249 } 250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698