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

Side by Side Diff: media/tools/player_x11/x11_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: Rebased at ToT 261185. 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/x11_video_renderer.h" 5 #include "media/tools/player_x11/x11_video_renderer.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <X11/Xutil.h> 8 #include <X11/Xutil.h>
9 #include <X11/extensions/Xrender.h> 9 #include <X11/extensions/Xrender.h>
10 #include <X11/extensions/Xcomposite.h> 10 #include <X11/extensions/Xcomposite.h>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const int visible_height = video_frame->visible_rect().height(); 93 const int visible_height = video_frame->visible_rect().height();
94 94
95 // Check if we need to reallocate our XImage. 95 // Check if we need to reallocate our XImage.
96 if (image_->width != coded_width || image_->height != coded_height) { 96 if (image_->width != coded_width || image_->height != coded_height) {
97 XDestroyImage(image_); 97 XDestroyImage(image_);
98 image_ = CreateImage(display_, coded_width, coded_height); 98 image_ = CreateImage(display_, coded_width, coded_height);
99 } 99 }
100 100
101 // Convert YUV frame to RGB. 101 // Convert YUV frame to RGB.
102 DCHECK(video_frame->format() == media::VideoFrame::YV12 || 102 DCHECK(video_frame->format() == media::VideoFrame::YV12 ||
103 video_frame->format() == media::VideoFrame::I420 ||
103 video_frame->format() == media::VideoFrame::YV16); 104 video_frame->format() == media::VideoFrame::YV16);
104 DCHECK(video_frame->stride(media::VideoFrame::kUPlane) == 105 DCHECK(video_frame->stride(media::VideoFrame::kUPlane) ==
105 video_frame->stride(media::VideoFrame::kVPlane)); 106 video_frame->stride(media::VideoFrame::kVPlane));
106 107
107 DCHECK(image_->data); 108 DCHECK(image_->data);
108 media::YUVType yuv_type = 109 media::YUVType yuv_type = (video_frame->format() == media::VideoFrame::YV12 ||
109 (video_frame->format() == media::VideoFrame::YV12) ? 110 video_frame->format() == media::VideoFrame::I420)
110 media::YV12 : media::YV16; 111 ? media::YV12
112 : media::YV16;
111 media::ConvertYUVToRGB32(video_frame->data(media::VideoFrame::kYPlane), 113 media::ConvertYUVToRGB32(video_frame->data(media::VideoFrame::kYPlane),
112 video_frame->data(media::VideoFrame::kUPlane), 114 video_frame->data(media::VideoFrame::kUPlane),
113 video_frame->data(media::VideoFrame::kVPlane), 115 video_frame->data(media::VideoFrame::kVPlane),
114 (uint8*)image_->data, coded_width, coded_height, 116 (uint8*)image_->data, coded_width, coded_height,
115 video_frame->stride(media::VideoFrame::kYPlane), 117 video_frame->stride(media::VideoFrame::kYPlane),
116 video_frame->stride(media::VideoFrame::kUPlane), 118 video_frame->stride(media::VideoFrame::kUPlane),
117 image_->bytes_per_line, 119 image_->bytes_per_line,
118 yuv_type); 120 yuv_type);
119 121
120 if (use_render_) { 122 if (use_render_) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 205
204 XRenderPictFormat* pictformat = XRenderFindVisualFormat( 206 XRenderPictFormat* pictformat = XRenderFindVisualFormat(
205 display_, 207 display_,
206 attr.visual); 208 attr.visual);
207 CHECK(pictformat) << "XRender does not support default visual"; 209 CHECK(pictformat) << "XRender does not support default visual";
208 210
209 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); 211 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL);
210 CHECK(picture_) << "Backing picture not created"; 212 CHECK(picture_) << "Backing picture not created";
211 } 213 }
212 } 214 }
OLDNEW
« media/filters/skcanvas_video_renderer.cc ('K') | « media/tools/player_x11/gl_video_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698