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

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

Issue 2759493002: Add DesktopCapturerId and attach it to DesktopFrame (Closed)
Patch Set: Resolve review comments Created 3 years, 9 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
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
17 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 18 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
18 #include "webrtc/modules/desktop_capture/desktop_region.h" 19 #include "webrtc/modules/desktop_capture/desktop_region.h"
19 #include "webrtc/modules/desktop_capture/shared_memory.h" 20 #include "webrtc/modules/desktop_capture/shared_memory.h"
20 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 // DesktopFrame represents a video frame captured from the screen. 25 // DesktopFrame represents a video frame captured from the screen.
25 class DesktopFrame { 26 class DesktopFrame {
26 public: 27 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void CopyPixelsFrom(const uint8_t* src_buffer, 62 void CopyPixelsFrom(const uint8_t* src_buffer,
62 int src_stride, 63 int src_stride,
63 const DesktopRect& dest_rect); 64 const DesktopRect& dest_rect);
64 void CopyPixelsFrom(const DesktopFrame& src_frame, 65 void CopyPixelsFrom(const DesktopFrame& src_frame,
65 const DesktopVector& src_pos, 66 const DesktopVector& src_pos,
66 const DesktopRect& dest_rect); 67 const DesktopRect& dest_rect);
67 68
68 // A helper to return the data pointer of a frame at the specified position. 69 // A helper to return the data pointer of a frame at the specified position.
69 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; 70 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const;
70 71
72 // The generator of current DesktopFrame. Not all DesktopCapturer
73 // implementations set this field.
74 DesktopCapturerId capturer_id() const { return capturer_id_; }
Sergey Ulanov 2017/03/21 00:39:36 I think this should be uint32_t if we want it to b
Hzj_jie 2017/03/21 18:40:40 Done.
75 void set_capturer_id(DesktopCapturerId capturer_id) {
76 capturer_id_ = capturer_id;
77 }
78
71 protected: 79 protected:
72 DesktopFrame(DesktopSize size, 80 DesktopFrame(DesktopSize size,
73 int stride, 81 int stride,
74 uint8_t* data, 82 uint8_t* data,
75 SharedMemory* shared_memory); 83 SharedMemory* shared_memory);
76 84
77 // Ownership of the buffers is defined by the classes that inherit from this 85 // Ownership of the buffers is defined by the classes that inherit from this
78 // class. They must guarantee that the buffer is not deleted before the frame 86 // class. They must guarantee that the buffer is not deleted before the frame
79 // is deleted. 87 // is deleted.
80 uint8_t* const data_; 88 uint8_t* const data_;
81 SharedMemory* const shared_memory_; 89 SharedMemory* const shared_memory_;
82 90
83 private: 91 private:
84 const DesktopSize size_; 92 const DesktopSize size_;
85 const int stride_; 93 const int stride_;
86 94
87 DesktopRegion updated_region_; 95 DesktopRegion updated_region_;
88 DesktopVector dpi_; 96 DesktopVector dpi_;
89 int64_t capture_time_ms_; 97 int64_t capture_time_ms_;
98 DesktopCapturerId capturer_id_;
90 99
91 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame); 100 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame);
92 }; 101 };
93 102
94 // A DesktopFrame that stores data in the heap. 103 // A DesktopFrame that stores data in the heap.
95 class BasicDesktopFrame : public DesktopFrame { 104 class BasicDesktopFrame : public DesktopFrame {
96 public: 105 public:
97 explicit BasicDesktopFrame(DesktopSize size); 106 explicit BasicDesktopFrame(DesktopSize size);
98 ~BasicDesktopFrame() override; 107 ~BasicDesktopFrame() override;
99 108
(...skipping 24 matching lines...) Expand all
124 ~SharedMemoryDesktopFrame() override; 133 ~SharedMemoryDesktopFrame() override;
125 134
126 private: 135 private:
127 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame); 136 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame);
128 }; 137 };
129 138
130 } // namespace webrtc 139 } // namespace webrtc
131 140
132 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ 141 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
133 142
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698