| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 void UnregisterActiveStreams() { | 93 void UnregisterActiveStreams() { |
| 94 for (auto& pair : display_stream_wrappers_) { | 94 for (auto& pair : display_stream_wrappers_) { |
| 95 DisplayStreamWrapper& wrapper = pair.second; | 95 DisplayStreamWrapper& wrapper = pair.second; |
| 96 if (wrapper.active) { | 96 if (wrapper.active) { |
| 97 wrapper.active = false; | 97 wrapper.active = false; |
| 98 CFRunLoopSourceRef source = | 98 CFRunLoopSourceRef source = |
| 99 CGDisplayStreamGetRunLoopSource(wrapper.stream); | 99 CGDisplayStreamGetRunLoopSource(wrapper.stream); |
| 100 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, | 100 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, |
| 101 kCFRunLoopDefaultMode); | 101 kCFRunLoopCommonModes); |
| 102 CGDisplayStreamStop(wrapper.stream); | 102 CGDisplayStreamStop(wrapper.stream); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 void PrepareForSelfDestruction() { | 107 void PrepareForSelfDestruction() { |
| 108 ready_for_self_destruction_ = true; | 108 ready_for_self_destruction_ = true; |
| 109 | 109 |
| 110 if (display_stream_wrappers_.empty()) | 110 if (display_stream_wrappers_.empty()) |
| 111 delete this; | 111 delete this; |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 CGDisplayStreamRef display_stream = CGDisplayStreamCreate( | 965 CGDisplayStreamRef display_stream = CGDisplayStreamCreate( |
| 966 display_id, pixel_width, pixel_height, 'BGRA', nullptr, handler); | 966 display_id, pixel_width, pixel_height, 'BGRA', nullptr, handler); |
| 967 | 967 |
| 968 if (display_stream) { | 968 if (display_stream) { |
| 969 CGError error = CGDisplayStreamStart(display_stream); | 969 CGError error = CGDisplayStreamStart(display_stream); |
| 970 if (error != kCGErrorSuccess) | 970 if (error != kCGErrorSuccess) |
| 971 return false; | 971 return false; |
| 972 | 972 |
| 973 CFRunLoopSourceRef source = | 973 CFRunLoopSourceRef source = |
| 974 CGDisplayStreamGetRunLoopSource(display_stream); | 974 CGDisplayStreamGetRunLoopSource(display_stream); |
| 975 CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode); | 975 CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes); |
| 976 display_stream_manager_->SaveStream(unique_id, display_stream); | 976 display_stream_manager_->SaveStream(unique_id, display_stream); |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 | 979 |
| 980 return true; | 980 return true; |
| 981 } | 981 } |
| 982 | 982 |
| 983 void ScreenCapturerMac::UnregisterRefreshAndMoveHandlers() { | 983 void ScreenCapturerMac::UnregisterRefreshAndMoveHandlers() { |
| 984 display_stream_manager_->UnregisterActiveStreams(); | 984 display_stream_manager_->UnregisterActiveStreams(); |
| 985 } | 985 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 std::unique_ptr<ScreenCapturerMac> capturer( | 1020 std::unique_ptr<ScreenCapturerMac> capturer( |
| 1021 new ScreenCapturerMac(options.configuration_monitor())); | 1021 new ScreenCapturerMac(options.configuration_monitor())); |
| 1022 if (!capturer.get()->Init()) { | 1022 if (!capturer.get()->Init()) { |
| 1023 return nullptr; | 1023 return nullptr; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 return capturer; | 1026 return capturer; |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 } // namespace webrtc | 1029 } // namespace webrtc |
| OLD | NEW |