Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h

Issue 2697453002: [DesktopCapturer] FallbackDesktopCapturerWrapper and its tests (Closed)
Patch Set: Resolve review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_FALLBACK_DESKTOP_CAPTURER_WRAPPER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_FALLBACK_DESKTOP_CAPTURER_WRAPPER_H_
13
14 #include <memory>
15
16 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
17 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
18 #include "webrtc/modules/desktop_capture/desktop_frame.h"
19 #include "webrtc/modules/desktop_capture/shared_memory.h"
20
21 namespace webrtc {
22
23 // A DesktopCapturer wrapper owns two DesktopCapturer implementations. If the
24 // main DesktopCapturer fails, it uses the secondary one instead. Two capturers
25 // are expected to return same SourceList, and the meaning of each SourceId is
26 // identical, otherwise FallbackDesktopCapturerWrapper may return frames from
27 // different sources.
28 class FallbackDesktopCapturerWrapper final : public DesktopCapturer,
29 public DesktopCapturer::Callback {
30 public:
31 FallbackDesktopCapturerWrapper(
32 std::unique_ptr<DesktopCapturer> main_capturer,
33 std::unique_ptr<DesktopCapturer> secondary_capturer);
34 ~FallbackDesktopCapturerWrapper() override;
35
36 // DesktopCapturer interface
Sergey Ulanov 2017/02/15 23:08:43 add '.' at the end of the comment
Hzj_jie 2017/02/16 01:57:07 Done.
37 void Start(DesktopCapturer::Callback* callback) override;
38 void SetSharedMemoryFactory(
39 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override;
40 void CaptureFrame() override;
41 void SetExcludedWindow(WindowId window) override;
42 bool GetSourceList(SourceList* sources) override;
43 bool SelectSource(SourceId id) override;
44 bool FocusOnSelectedSource() override;
45
46 private:
47 // DesktopCapturer::Callback interface
Sergey Ulanov 2017/02/15 23:08:43 end comment with a period
Hzj_jie 2017/02/16 01:57:07 Done.
48 void OnCaptureResult(Result result,
49 std::unique_ptr<DesktopFrame> frame) override;
50
51 const std::unique_ptr<DesktopCapturer> main_capturer_;
52 const std::unique_ptr<DesktopCapturer> secondary_capturer_;
53 std::unique_ptr<SharedMemoryFactoryWrapper> shared_memory_factory_;
54 bool main_capturer_permanent_error_ = false;
55 DesktopCapturer::Callback* callback_ = nullptr;
56 };
57
58 } // namespace webrtc
59
60 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_FALLBACK_DESKTOP_CAPTURER_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698