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

Side by Side Diff: webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc

Issue 2787263003: Delete all log messages depending on system_wrappers. (Closed)
Patch Set: Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" 11 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <string.h> 14 #include <string.h>
15 #include <sys/shm.h> 15 #include <sys/shm.h>
16 16
17 #include "webrtc/modules/desktop_capture/desktop_frame.h" 17 #include "webrtc/modules/desktop_capture/desktop_frame.h"
18 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" 18 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h"
19 #include "webrtc/system_wrappers/include/logging.h"
20 19
21 namespace { 20 namespace {
22 21
23 // Returns the number of bits |mask| has to be shifted left so its last 22 // Returns the number of bits |mask| has to be shifted left so its last
24 // (most-significant) bit set becomes the most-significant bit of the word. 23 // (most-significant) bit set becomes the most-significant bit of the word.
25 // When |mask| is 0 the function returns 31. 24 // When |mask| is 0 the function returns 31.
26 uint32_t MaskToShift(uint32_t mask) { 25 uint32_t MaskToShift(uint32_t mask) {
27 int shift = 0; 26 int shift = 0;
28 if ((mask & 0xffff0000u) == 0) { 27 if ((mask & 0xffff0000u) == 0) {
29 mask <<= 16; 28 mask <<= 16;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (shmat_result != reinterpret_cast<void*>(-1)) { 142 if (shmat_result != reinterpret_cast<void*>(-1)) {
144 shm_segment_info_->shmaddr = reinterpret_cast<char*>(shmat_result); 143 shm_segment_info_->shmaddr = reinterpret_cast<char*>(shmat_result);
145 x_image_->data = shm_segment_info_->shmaddr; 144 x_image_->data = shm_segment_info_->shmaddr;
146 145
147 XErrorTrap error_trap(display_); 146 XErrorTrap error_trap(display_);
148 using_shm = XShmAttach(display_, shm_segment_info_); 147 using_shm = XShmAttach(display_, shm_segment_info_);
149 XSync(display_, False); 148 XSync(display_, False);
150 if (error_trap.GetLastErrorAndDisable() != 0) 149 if (error_trap.GetLastErrorAndDisable() != 0)
151 using_shm = false; 150 using_shm = false;
152 if (using_shm) { 151 if (using_shm) {
153 LOG(LS_VERBOSE) << "Using X shared memory segment "
154 << shm_segment_info_->shmid;
155 } 152 }
156 } 153 }
157 } else { 154 } else {
158 LOG(LS_WARNING) << "Failed to get shared memory segment. "
159 "Performance may be degraded.";
160 } 155 }
161 } 156 }
162 157
163 if (!using_shm) { 158 if (!using_shm) {
164 LOG(LS_WARNING) << "Not using shared memory. Performance may be degraded.";
165 ReleaseSharedMemorySegment(); 159 ReleaseSharedMemorySegment();
166 return; 160 return;
167 } 161 }
168 162
169 if (have_pixmaps) 163 if (have_pixmaps)
170 have_pixmaps = InitPixmaps(default_depth); 164 have_pixmaps = InitPixmaps(default_depth);
171 165
172 shmctl(shm_segment_info_->shmid, IPC_RMID, 0); 166 shmctl(shm_segment_info_->shmid, IPC_RMID, 0);
173 shm_segment_info_->shmid = -1; 167 shm_segment_info_->shmid = -1;
174
175 LOG(LS_VERBOSE) << "Using X shared memory extension v"
176 << major << "." << minor
177 << " with" << (have_pixmaps ? "" : "out") << " pixmaps.";
178 } 168 }
179 169
180 bool XServerPixelBuffer::InitPixmaps(int depth) { 170 bool XServerPixelBuffer::InitPixmaps(int depth) {
181 if (XShmPixmapFormat(display_) != ZPixmap) 171 if (XShmPixmapFormat(display_) != ZPixmap)
182 return false; 172 return false;
183 173
184 { 174 {
185 XErrorTrap error_trap(display_); 175 XErrorTrap error_trap(display_);
186 shm_pixmap_ = XShmCreatePixmap(display_, window_, 176 shm_pixmap_ = XShmCreatePixmap(display_, window_,
187 shm_segment_info_->shmaddr, 177 shm_segment_info_->shmaddr,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Write as 32-bit RGB. 329 // Write as 32-bit RGB.
340 dst_pos_32[x] = ((r >> 8) & 0xff0000) | ((g >> 16) & 0xff00) | 330 dst_pos_32[x] = ((r >> 8) & 0xff0000) | ((g >> 16) & 0xff00) |
341 ((b >> 24) & 0xff); 331 ((b >> 24) & 0xff);
342 } 332 }
343 dst_pos += frame->stride(); 333 dst_pos += frame->stride();
344 src_pos += src_stride; 334 src_pos += src_stride;
345 } 335 }
346 } 336 }
347 337
348 } // namespace webrtc 338 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/x11/shared_x_display.cc ('k') | webrtc/modules/utility/source/process_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698