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

Side by Side Diff: webrtc/modules/desktop_capture/desktop_frame.cc

Issue 2759493002: Add DesktopCapturerId and attach it to DesktopFrame (Closed)
Patch Set: Remove dependency of webrtc/media:rtc_media_base Created 3 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
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/desktop_frame.h" 11 #include "webrtc/modules/desktop_capture/desktop_frame.h"
12 12
13 #include <utility> 13 #include <utility>
14 14
15 #include <string.h> 15 #include <string.h>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 DesktopFrame::DesktopFrame(DesktopSize size, 21 DesktopFrame::DesktopFrame(DesktopSize size,
22 int stride, 22 int stride,
23 uint8_t* data, 23 uint8_t* data,
24 SharedMemory* shared_memory) 24 SharedMemory* shared_memory)
25 : data_(data), 25 : data_(data),
26 shared_memory_(shared_memory), 26 shared_memory_(shared_memory),
27 size_(size), 27 size_(size),
28 stride_(stride), 28 stride_(stride),
29 capture_time_ms_(0) { 29 capture_time_ms_(0),
30 } 30 capturer_id_(DesktopCapturerId::kUnknown) {}
31 31
32 DesktopFrame::~DesktopFrame() {} 32 DesktopFrame::~DesktopFrame() {}
33 33
34 void DesktopFrame::CopyPixelsFrom(const uint8_t* src_buffer, int src_stride, 34 void DesktopFrame::CopyPixelsFrom(const uint8_t* src_buffer, int src_stride,
35 const DesktopRect& dest_rect) { 35 const DesktopRect& dest_rect) {
36 RTC_CHECK(DesktopRect::MakeSize(size()).ContainsRect(dest_rect)); 36 RTC_CHECK(DesktopRect::MakeSize(size()).ContainsRect(dest_rect));
37 37
38 uint8_t* dest = GetFrameDataAtPos(dest_rect.top_left()); 38 uint8_t* dest = GetFrameDataAtPos(dest_rect.top_left());
39 for (int y = 0; y < dest_rect.height(); ++y) { 39 for (int y = 0; y < dest_rect.height(); ++y) {
40 memcpy(dest, src_buffer, DesktopFrame::kBytesPerPixel * dest_rect.width()); 40 memcpy(dest, src_buffer, DesktopFrame::kBytesPerPixel * dest_rect.width());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 : DesktopFrame(size, 109 : DesktopFrame(size,
110 stride, 110 stride,
111 reinterpret_cast<uint8_t*>(shared_memory->data()), 111 reinterpret_cast<uint8_t*>(shared_memory->data()),
112 shared_memory) {} 112 shared_memory) {}
113 113
114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { 114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() {
115 delete shared_memory_; 115 delete shared_memory_;
116 } 116 }
117 117
118 } // namespace webrtc 118 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_frame.h ('k') | webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698