| Index: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
|
| diff --git a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
|
| index b17c195340b0e495fa6e123a2b33c06141e9a2c5..122ad1f6e159cab692eb28394588145173f075f2 100644
|
| --- a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
|
| +++ b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
|
| @@ -16,6 +16,8 @@
|
| #include <DXGIFormat.h>
|
| #include <Windows.h>
|
|
|
| +#include <algorithm>
|
| +
|
| #include "webrtc/base/checks.h"
|
| #include "webrtc/base/logging.h"
|
| #include "webrtc/modules/desktop_capture/win/dxgi_texture_mapping.h"
|
| @@ -274,29 +276,20 @@ void DxgiOutputDuplicator::Setup(Context* context) {
|
| RTC_DCHECK(context->updated_region.is_empty());
|
| // Always copy entire monitor during the first Duplicate() function call.
|
| context->updated_region.AddRect(desktop_rect_);
|
| - for (size_t i = 0; i < contexts_.size(); i++) {
|
| - if (contexts_[i] == nullptr) {
|
| - contexts_[i] = context;
|
| - return;
|
| - }
|
| - }
|
| -
|
| + RTC_DCHECK(std::find(contexts_.begin(), contexts_.end(), context) ==
|
| + contexts_.end());
|
| contexts_.push_back(context);
|
| }
|
|
|
| void DxgiOutputDuplicator::Unregister(const Context* const context) {
|
| - for (size_t i = 0; i < contexts_.size(); i++) {
|
| - if (contexts_[i] == context) {
|
| - contexts_[i] = nullptr;
|
| - return;
|
| - }
|
| - }
|
| -
|
| - RTC_NOTREACHED();
|
| + auto it = std::find(contexts_.begin(), contexts_.end(), context);
|
| + RTC_DCHECK(it != contexts_.end());
|
| + contexts_.erase(it);
|
| }
|
|
|
| void DxgiOutputDuplicator::SpreadContextChange(const Context* const source) {
|
| for (Context* dest : contexts_) {
|
| + RTC_DCHECK(dest);
|
| if (dest != source) {
|
| dest->updated_region.AddRegion(source->updated_region);
|
| }
|
|
|