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

Unified Diff: webrtc/modules/desktop_capture/fake_desktop_capturer.h

Issue 2468753002: Add CreateWindowCapturer() and CreateScreenCapturer() in DesktopCapturer (Closed)
Patch Set: Build break without X11 Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/fake_desktop_capturer.h
diff --git a/webrtc/modules/desktop_capture/fake_desktop_capturer.h b/webrtc/modules/desktop_capture/fake_desktop_capturer.h
index fa5ccba7eb15c2e9b46dcd3c78ceb1ac7c684e9a..30187775408653bf9e5fd480a150ca3d319f59cc 100644
--- a/webrtc/modules/desktop_capture/fake_desktop_capturer.h
+++ b/webrtc/modules/desktop_capture/fake_desktop_capturer.h
@@ -15,6 +15,7 @@
#include <utility>
#include "webrtc/modules/desktop_capture/desktop_capturer.h"
+#include "webrtc/modules/desktop_capture/desktop_capture_types.h"
#include "webrtc/modules/desktop_capture/desktop_frame_generator.h"
#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
#include "webrtc/modules/desktop_capture/shared_memory.h"
@@ -37,7 +38,7 @@ namespace webrtc {
//
// TODO(zijiehe): Remove template T once we merge ScreenCapturer and
// WindowCapturer.
-template <typename T>
+template <typename T = DesktopCapturer>
class FakeDesktopCapturer : public T {
public:
FakeDesktopCapturer()
@@ -83,7 +84,20 @@ class FakeDesktopCapturer : public T {
shared_memory_factory_ = std::move(shared_memory_factory);
}
+ bool GetSourceList(DesktopCapturer::SourceList* sources) override {
+ sources->push_back({kWindowId, "A-Fake-DesktopCapturer-Window"});
+ sources->push_back({kScreenId});
+ return true;
+ }
+
+ bool SelectSource(DesktopCapturer::SourceId id) override {
+ return id == kWindowId || id == kScreenId || id == kFullDesktopScreenId;
+ }
+
private:
+ static constexpr DesktopCapturer::SourceId kWindowId = 1378277495;
+ static constexpr DesktopCapturer::SourceId kScreenId = 1378277496;
+
DesktopCapturer::Callback* callback_;
std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
DesktopCapturer::Result result_;

Powered by Google App Engine
This is Rietveld 408576698