OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 22 matching lines...) Expand all Loading... | |
33 if (resolution_change_detector_.IsChanged(size)) { | 33 if (resolution_change_detector_.IsChanged(size)) { |
34 // Once the output size changed, recreate the SharedDesktopFrame. | 34 // Once the output size changed, recreate the SharedDesktopFrame. |
35 frame_.reset(); | 35 frame_.reset(); |
36 resolution_change_detector_.Reset(); | 36 resolution_change_detector_.Reset(); |
37 } | 37 } |
38 | 38 |
39 if (!frame_) { | 39 if (!frame_) { |
40 std::unique_ptr<DesktopFrame> frame; | 40 std::unique_ptr<DesktopFrame> frame; |
41 if (factory_) { | 41 if (factory_) { |
42 frame = SharedMemoryDesktopFrame::Create(size, factory_); | 42 frame = SharedMemoryDesktopFrame::Create(size, factory_); |
43 // DirectX capturer won't paint each pixel in the frame due to its one | |
44 // capturer per monitor design. So once the new frame is created from | |
45 // shared memory, we should clear it to avoid the legacy image to be | |
46 // remained on it. See http://crbug.com/708766. | |
47 memset(frame->data(), 0, frame->stride() * frame->size().height()); | |
Sergey Ulanov
2017/04/20 22:01:10
I don't think it matters if it's a sharedmemory or
Hzj_jie
2017/04/20 22:48:58
Sorry, I always under the impression that we are u
| |
43 } else { | 48 } else { |
44 frame.reset(new BasicDesktopFrame(size)); | 49 frame.reset(new BasicDesktopFrame(size)); |
45 } | 50 } |
46 if (!frame) { | 51 if (!frame) { |
47 return false; | 52 return false; |
48 } | 53 } |
49 | 54 |
50 frame_ = SharedDesktopFrame::Wrap(std::move(frame)); | 55 frame_ = SharedDesktopFrame::Wrap(std::move(frame)); |
51 } | 56 } |
52 | 57 |
53 return !!frame_; | 58 return !!frame_; |
54 } | 59 } |
55 | 60 |
56 SharedDesktopFrame* DxgiFrame::frame() const { | 61 SharedDesktopFrame* DxgiFrame::frame() const { |
57 RTC_DCHECK(frame_); | 62 RTC_DCHECK(frame_); |
58 return frame_.get(); | 63 return frame_.get(); |
59 } | 64 } |
60 | 65 |
61 DxgiFrame::Context* DxgiFrame::context() { | 66 DxgiFrame::Context* DxgiFrame::context() { |
62 RTC_DCHECK(frame_); | 67 RTC_DCHECK(frame_); |
63 return &context_; | 68 return &context_; |
64 } | 69 } |
65 | 70 |
66 } // namespace webrtc | 71 } // namespace webrtc |
OLD | NEW |