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

Side by Side Diff: media/cast/test/linux_output_window.cc

Issue 184813009: Cast Streaming API end-to-end browser_test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix LoggingImplTest + REBASE Created 6 years, 9 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
« no previous file with comments | « media/cast/test/linux_output_window.h ('k') | media/cast/test/receiver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cast/test/linux_output_window.h" 5 #include "media/cast/test/linux_output_window.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/video_frame.h" 8 #include "media/base/video_frame.h"
9 #include "third_party/libyuv/include/libyuv/convert.h" 9 #include "third_party/libyuv/include/libyuv/convert.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // create shared memory image 99 // create shared memory image
100 image_ = XShmCreateImage( 100 image_ = XShmCreateImage(
101 display_, CopyFromParent, 24, ZPixmap, NULL, &shminfo_, width, height); 101 display_, CopyFromParent, 24, ZPixmap, NULL, &shminfo_, width, height);
102 shminfo_.shmid = shmget( 102 shminfo_.shmid = shmget(
103 IPC_PRIVATE, (image_->bytes_per_line * image_->height), IPC_CREAT | 0777); 103 IPC_PRIVATE, (image_->bytes_per_line * image_->height), IPC_CREAT | 0777);
104 shminfo_.shmaddr = image_->data = (char*)shmat(shminfo_.shmid, 0, 0); 104 shminfo_.shmaddr = image_->data = (char*)shmat(shminfo_.shmid, 0, 0);
105 if (image_->data == reinterpret_cast<char*>(-1)) { 105 if (image_->data == reinterpret_cast<char*>(-1)) {
106 VLOG(1) << "XShmCreateImage failed"; 106 VLOG(1) << "XShmCreateImage failed";
107 NOTREACHED(); 107 NOTREACHED();
108 } 108 }
109 render_buffer_ = reinterpret_cast<uint8_t*>(image_->data);
110 shminfo_.readOnly = false; 109 shminfo_.readOnly = false;
111 110
112 // Attach image to display. 111 // Attach image to display.
113 if (!XShmAttach(display_, &shminfo_)) { 112 if (!XShmAttach(display_, &shminfo_)) {
114 VLOG(1) << "XShmAttach failed"; 113 VLOG(1) << "XShmAttach failed";
115 NOTREACHED(); 114 NOTREACHED();
116 } 115 }
117 XSync(display_, false); 116 XSync(display_, false);
118 } 117 }
119 118
120 void LinuxOutputWindow::RenderFrame( 119 void LinuxOutputWindow::RenderFrame(
121 const scoped_refptr<media::VideoFrame>& video_frame) { 120 const scoped_refptr<media::VideoFrame>& video_frame) {
121 CHECK_LE(video_frame->coded_size().width(), image_->width);
122 CHECK_LE(video_frame->coded_size().height(), image_->height);
122 libyuv::I420ToARGB(video_frame->data(VideoFrame::kYPlane), 123 libyuv::I420ToARGB(video_frame->data(VideoFrame::kYPlane),
123 video_frame->stride(VideoFrame::kYPlane), 124 video_frame->stride(VideoFrame::kYPlane),
124 video_frame->data(VideoFrame::kUPlane), 125 video_frame->data(VideoFrame::kUPlane),
125 video_frame->stride(VideoFrame::kUPlane), 126 video_frame->stride(VideoFrame::kUPlane),
126 video_frame->data(VideoFrame::kVPlane), 127 video_frame->data(VideoFrame::kVPlane),
127 video_frame->stride(VideoFrame::kVPlane), 128 video_frame->stride(VideoFrame::kVPlane),
128 render_buffer_, 129 reinterpret_cast<uint8_t*>(image_->data),
129 video_frame->stride(VideoFrame::kYPlane) * 4, 130 image_->bytes_per_line,
130 video_frame->coded_size().width(), 131 video_frame->coded_size().width(),
131 video_frame->coded_size().height()); 132 video_frame->coded_size().height());
132 133
133 // Place image in window. 134 // Place image in window.
134 XShmPutImage(display_, 135 XShmPutImage(display_,
135 window_, 136 window_,
136 gc_, 137 gc_,
137 image_, 138 image_,
138 0, 139 0,
139 0, 140 0,
140 0, 141 0,
141 0, 142 0,
142 video_frame->coded_size().width(), 143 video_frame->coded_size().width(),
143 video_frame->coded_size().height(), 144 video_frame->coded_size().height(),
144 true); 145 true);
145 146
146 // Very important for the image to update properly! 147 // Very important for the image to update properly!
147 XSync(display_, false); 148 XSync(display_, false);
148 } 149 }
149 150
150 } // namespace test 151 } // namespace test
151 } // namespace cast 152 } // namespace cast
152 } // namespace media 153 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/linux_output_window.h ('k') | media/cast/test/receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698