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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/video/capture/screen/shared_desktop_frame.h"
6
7 #include "base/memory/scoped_ptr.h"
8
9 namespace media {
10
11 class SharedDesktopFrame::Core : public base::RefCountedThreadSafe<Core> {
12 public:
13 Core(webrtc::DesktopFrame* frame) : frame_(frame) {}
14
15 webrtc::DesktopFrame* frame() { return frame_.get(); }
16
17 private:
18 friend class base::RefCountedThreadSafe<Core>;
19 virtual ~Core() {}
20
21 scoped_ptr<webrtc::DesktopFrame> frame_;
22
23 DISALLOW_COPY_AND_ASSIGN(Core);
24 };
25
26 SharedDesktopFrame::~SharedDesktopFrame() {}
27
28 // static
29 SharedDesktopFrame* SharedDesktopFrame::Wrap(
30 webrtc::DesktopFrame* desktop_frame) {
31 return new SharedDesktopFrame(new Core(desktop_frame));
32 }
33
34 webrtc::DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() {
35 return core_->frame();
36 }
37
38 SharedDesktopFrame* SharedDesktopFrame::Share() {
39 SharedDesktopFrame* result = new SharedDesktopFrame(core_);
40 result->set_dpi(dpi());
41 result->set_capture_time_ms(capture_time_ms());
42 *result->mutable_updated_region() = updated_region();
43 return result;
44 }
45
46 bool SharedDesktopFrame::IsShared() {
47 return !core_->HasOneRef();
48 }
49
50 SharedDesktopFrame::SharedDesktopFrame(scoped_refptr<Core> core)
51 : DesktopFrame(core->frame()->size(), core->frame()->stride(),
52 core->frame()->data(), core->frame()->shared_memory()),
53 core_(core) {
54 }
55
56 } // namespace media
OLDNEW
« 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