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

Side by Side Diff: webrtc/video_frame.h

Issue 1158273010: Re-land "Convert native handles to buffers before encoding." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « webrtc/video_engine/vie_encoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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_VIDEO_FRAME_H_ 11 #ifndef WEBRTC_VIDEO_FRAME_H_
12 #define WEBRTC_VIDEO_FRAME_H_ 12 #define WEBRTC_VIDEO_FRAME_H_
13 13
14 #include "webrtc/base/scoped_ref_ptr.h" 14 #include "webrtc/base/scoped_ref_ptr.h"
15 #include "webrtc/common_video/interface/video_frame_buffer.h" 15 #include "webrtc/common_video/interface/video_frame_buffer.h"
16 #include "webrtc/common_video/rotation.h" 16 #include "webrtc/common_video/rotation.h"
17 #include "webrtc/typedefs.h" 17 #include "webrtc/typedefs.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 class VideoFrame { 21 class VideoFrame {
22 public: 22 public:
23 VideoFrame(); 23 VideoFrame();
24 VideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, 24 VideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
25 uint32_t timestamp, 25 uint32_t timestamp,
26 int64_t render_time_ms, 26 int64_t render_time_ms,
27 VideoRotation rotation); 27 VideoRotation rotation);
28 VideoFrame(void* native_handle,
29 int width,
30 int height,
31 uint32_t timestamp,
32 int64_t render_time_ms,
33 VideoRotation rotation,
34 const rtc::Callback0<void>& no_longer_used);
35 28
36 // TODO(pbos): Make all create/copy functions void, they should not be able to 29 // TODO(pbos): Make all create/copy functions void, they should not be able to
37 // fail (which should be DCHECK/CHECKed instead). 30 // fail (which should be DCHECK/CHECKed instead).
38 31
39 // CreateEmptyFrame: Sets frame dimensions and allocates buffers based 32 // CreateEmptyFrame: Sets frame dimensions and allocates buffers based
40 // on set dimensions - height and plane stride. 33 // on set dimensions - height and plane stride.
41 // If required size is bigger than the allocated one, new buffers of adequate 34 // If required size is bigger than the allocated one, new buffers of adequate
42 // size will be allocated. 35 // size will be allocated.
43 // Return value: 0 on success, -1 on error. 36 // Return value: 0 on success, -1 on error.
44 int CreateEmptyFrame(int width, 37 int CreateEmptyFrame(int width,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // longer in use, so the underlying resource can be freed. 146 // longer in use, so the underlying resource can be freed.
154 void* native_handle() const; 147 void* native_handle() const;
155 148
156 // Return the underlying buffer. 149 // Return the underlying buffer.
157 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; 150 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const;
158 151
159 // Set the underlying buffer. 152 // Set the underlying buffer.
160 void set_video_frame_buffer( 153 void set_video_frame_buffer(
161 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); 154 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer);
162 155
156 // Convert native-handle frame to memory-backed I420 frame. Should not be
157 // called on a non-native-handle frame.
158 VideoFrame ConvertNativeToI420Frame() const;
159
163 private: 160 private:
164 // An opaque reference counted handle that stores the pixel data. 161 // An opaque reference counted handle that stores the pixel data.
165 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; 162 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
166 uint32_t timestamp_; 163 uint32_t timestamp_;
167 int64_t ntp_time_ms_; 164 int64_t ntp_time_ms_;
168 int64_t render_time_ms_; 165 int64_t render_time_ms_;
169 VideoRotation rotation_; 166 VideoRotation rotation_;
170 }; 167 };
171 168
172 enum VideoFrameType { 169 enum VideoFrameType {
(...skipping 20 matching lines...) Expand all
193 // TODO(pbos): Use webrtc::FrameType directly (and remove VideoFrameType). 190 // TODO(pbos): Use webrtc::FrameType directly (and remove VideoFrameType).
194 VideoFrameType _frameType = kDeltaFrame; 191 VideoFrameType _frameType = kDeltaFrame;
195 uint8_t* _buffer; 192 uint8_t* _buffer;
196 size_t _length; 193 size_t _length;
197 size_t _size; 194 size_t _size;
198 bool _completeFrame = false; 195 bool _completeFrame = false;
199 }; 196 };
200 197
201 } // namespace webrtc 198 } // namespace webrtc
202 #endif // WEBRTC_VIDEO_FRAME_H_ 199 #endif // WEBRTC_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « webrtc/video_engine/vie_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698