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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 Atomic32 ref_count_; | 42 Atomic32 ref_count_; |
43 std::unique_ptr<DesktopFrame> frame_; | 43 std::unique_ptr<DesktopFrame> frame_; |
44 | 44 |
45 RTC_DISALLOW_COPY_AND_ASSIGN(Core); | 45 RTC_DISALLOW_COPY_AND_ASSIGN(Core); |
46 }; | 46 }; |
47 | 47 |
48 SharedDesktopFrame::~SharedDesktopFrame() {} | 48 SharedDesktopFrame::~SharedDesktopFrame() {} |
49 | 49 |
50 // static | 50 // static |
51 SharedDesktopFrame* SharedDesktopFrame::Wrap(DesktopFrame* desktop_frame) { | 51 SharedDesktopFrame* SharedDesktopFrame::Wrap( |
| 52 DesktopFrame* desktop_frame) { |
52 rtc::scoped_refptr<Core> core(new Core(desktop_frame)); | 53 rtc::scoped_refptr<Core> core(new Core(desktop_frame)); |
53 return new SharedDesktopFrame(core); | 54 return new SharedDesktopFrame(core); |
54 } | 55 } |
55 | 56 |
56 DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { | 57 DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { |
57 return core_->frame(); | 58 return core_->frame(); |
58 } | 59 } |
59 | 60 |
60 SharedDesktopFrame* SharedDesktopFrame::Share() { | 61 SharedDesktopFrame* SharedDesktopFrame::Share() { |
61 SharedDesktopFrame* result = new SharedDesktopFrame(core_); | 62 SharedDesktopFrame* result = new SharedDesktopFrame(core_); |
62 result->set_dpi(dpi()); | 63 result->set_dpi(dpi()); |
63 result->set_capture_time_ms(capture_time_ms()); | 64 result->set_capture_time_ms(capture_time_ms()); |
64 *result->mutable_updated_region() = updated_region(); | 65 *result->mutable_updated_region() = updated_region(); |
65 return result; | 66 return result; |
66 } | 67 } |
67 | 68 |
68 bool SharedDesktopFrame::IsShared() { | 69 bool SharedDesktopFrame::IsShared() { |
69 return !core_->HasOneRef(); | 70 return !core_->HasOneRef(); |
70 } | 71 } |
71 | 72 |
72 SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) | 73 SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) |
73 : DesktopFrame(core->frame()->size(), | 74 : DesktopFrame(core->frame()->size(), |
74 core->frame()->stride(), | 75 core->frame()->stride(), |
75 core->frame()->data(), | 76 core->frame()->data(), |
76 core->frame()->shared_memory()), | 77 core->frame()->shared_memory()), |
77 core_(core) { | 78 core_(core) { |
78 } | 79 } |
79 | 80 |
80 } // namespace webrtc | 81 } // namespace webrtc |
OLD | NEW |