| OLD | NEW |
| 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 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 rtc::scoped_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create( | 81 rtc::scoped_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create( |
| 82 DesktopSize size, | 82 DesktopSize size, |
| 83 SharedMemoryFactory* shared_memory_factory) { | 83 SharedMemoryFactory* shared_memory_factory) { |
| 84 size_t buffer_size = | 84 size_t buffer_size = |
| 85 size.width() * size.height() * DesktopFrame::kBytesPerPixel; | 85 size.width() * size.height() * DesktopFrame::kBytesPerPixel; |
| 86 rtc::scoped_ptr<SharedMemory> shared_memory; | 86 rtc::scoped_ptr<SharedMemory> shared_memory; |
| 87 shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size); | 87 shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size); |
| 88 if (!shared_memory) | 88 if (!shared_memory) |
| 89 return nullptr; | 89 return nullptr; |
| 90 | 90 |
| 91 return rtc_make_scoped_ptr(new SharedMemoryDesktopFrame( | 91 return rtc::scoped_ptr<DesktopFrame>(new SharedMemoryDesktopFrame( |
| 92 size, size.width() * DesktopFrame::kBytesPerPixel, | 92 size, size.width() * DesktopFrame::kBytesPerPixel, |
| 93 std::move(shared_memory))); | 93 std::move(shared_memory))); |
| 94 } | 94 } |
| 95 | 95 |
| 96 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size, | 96 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size, |
| 97 int stride, | 97 int stride, |
| 98 SharedMemory* shared_memory) | 98 SharedMemory* shared_memory) |
| 99 : DesktopFrame(size, | 99 : DesktopFrame(size, |
| 100 stride, | 100 stride, |
| 101 reinterpret_cast<uint8_t*>(shared_memory->data()), | 101 reinterpret_cast<uint8_t*>(shared_memory->data()), |
| 102 shared_memory) {} | 102 shared_memory) {} |
| 103 | 103 |
| 104 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame( | 104 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame( |
| 105 DesktopSize size, | 105 DesktopSize size, |
| 106 int stride, | 106 int stride, |
| 107 rtc::scoped_ptr<SharedMemory> shared_memory) | 107 rtc::scoped_ptr<SharedMemory> shared_memory) |
| 108 : DesktopFrame(size, | 108 : DesktopFrame(size, |
| 109 stride, | 109 stride, |
| 110 reinterpret_cast<uint8_t*>(shared_memory->data()), | 110 reinterpret_cast<uint8_t*>(shared_memory->data()), |
| 111 shared_memory.release()) {} | 111 shared_memory.release()) {} |
| 112 | 112 |
| 113 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { | 113 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { |
| 114 delete shared_memory_; | 114 delete shared_memory_; |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace webrtc | 117 } // namespace webrtc |
| OLD | NEW |