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

Unified Diff: media/video/capture/screen/shared_desktop_frame.cc

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/screen/shared_desktop_frame.cc
diff --git a/media/video/capture/screen/shared_desktop_frame.cc b/media/video/capture/screen/shared_desktop_frame.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b0a6f14faaec098c5fc0b1d03af7233652a4c7fe
--- /dev/null
+++ b/media/video/capture/screen/shared_desktop_frame.cc
@@ -0,0 +1,56 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/video/capture/screen/shared_desktop_frame.h"
+
+#include "base/memory/scoped_ptr.h"
+
+namespace media {
+
+class SharedDesktopFrame::Core : public base::RefCountedThreadSafe<Core> {
+ public:
+ Core(webrtc::DesktopFrame* frame) : frame_(frame) {}
+
+ webrtc::DesktopFrame* frame() { return frame_.get(); }
+
+ private:
+ friend class base::RefCountedThreadSafe<Core>;
+ virtual ~Core() {}
+
+ scoped_ptr<webrtc::DesktopFrame> frame_;
+
+ DISALLOW_COPY_AND_ASSIGN(Core);
+};
+
+SharedDesktopFrame::~SharedDesktopFrame() {}
+
+// static
+SharedDesktopFrame* SharedDesktopFrame::Wrap(
+ webrtc::DesktopFrame* desktop_frame) {
+ return new SharedDesktopFrame(new Core(desktop_frame));
+}
+
+webrtc::DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() {
+ return core_->frame();
+}
+
+SharedDesktopFrame* SharedDesktopFrame::Share() {
+ SharedDesktopFrame* result = new SharedDesktopFrame(core_);
+ result->set_dpi(dpi());
+ result->set_capture_time_ms(capture_time_ms());
+ *result->mutable_updated_region() = updated_region();
+ return result;
+}
+
+bool SharedDesktopFrame::IsShared() {
+ return !core_->HasOneRef();
+}
+
+SharedDesktopFrame::SharedDesktopFrame(scoped_refptr<Core> core)
+ : DesktopFrame(core->frame()->size(), core->frame()->stride(),
+ core->frame()->data(), core->frame()->shared_memory()),
+ core_(core) {
+}
+
+} // namespace media
« no previous file with comments | « media/video/capture/screen/shared_desktop_frame.h ('k') | media/video/capture/screen/x11/x_server_pixel_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698