blob: 90e1fbd3e3f63bee2c5e427c1f457f2378998494 [file] [log] [blame]
sergeyu@chromium.org15e32cc2013-04-29 20:10:57 +00001/*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "webrtc/modules/desktop_capture/desktop_frame.h"
12
13namespace webrtc {
14
15DesktopFrame::DesktopFrame(DesktopSize size,
16 int stride,
17 uint8_t* data,
18 SharedMemory* shared_memory)
19 : size_(size),
20 stride_(stride),
21 data_(data),
22 shared_memory_(shared_memory),
23 capture_time_ms_(0) {
24}
25
26DesktopFrame::~DesktopFrame() {}
27
28BasicDesktopFrame::BasicDesktopFrame(DesktopSize size)
29 : DesktopFrame(size, kBytesPerPixel * size.width(),
30 new uint8_t[kBytesPerPixel * size.width() * size.height()],
31 NULL) {
32}
33
34BasicDesktopFrame::~BasicDesktopFrame() {
35 delete[] data_;
36}
37
38SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(
39 DesktopSize size,
40 int stride,
41 SharedMemory* shared_memory)
42 : DesktopFrame(size, stride,
43 reinterpret_cast<uint8_t*>(shared_memory->data()),
44 shared_memory) {
45}
46
47SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() {
48 delete shared_memory_;
49}
50
51} // namespace webrtc