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

Side by Side Diff: webrtc/video_frame.h

Issue 2541863002: Delete VideoFrame default constructor, and IsZeroSize method. (Closed)
Patch Set: Initialize pixel data in VideoBroadcasterTest.OnFrame test. Created 4 years 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/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/base/timeutils.h" 15 #include "webrtc/base/timeutils.h"
16 #include "webrtc/common_types.h" 16 #include "webrtc/common_types.h"
17 #include "webrtc/common_video/include/video_frame_buffer.h" 17 #include "webrtc/common_video/include/video_frame_buffer.h"
18 #include "webrtc/common_video/rotation.h" 18 #include "webrtc/common_video/rotation.h"
19 #include "webrtc/typedefs.h" 19 #include "webrtc/typedefs.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 class VideoFrame { 23 class VideoFrame {
24 public: 24 public:
25 // TODO(nisse): Deprecated. Using the default constructor violates the
26 // reasonable assumption that video_frame_buffer() returns a valid buffer.
27 VideoFrame();
28
29 // TODO(nisse): This constructor is consistent with 25 // TODO(nisse): This constructor is consistent with
30 // cricket::WebRtcVideoFrame. After the class 26 // cricket::WebRtcVideoFrame. After the class
31 // cricket::WebRtcVideoFrame and its baseclass cricket::VideoFrame 27 // cricket::WebRtcVideoFrame and its baseclass cricket::VideoFrame
32 // are deleted, we should consider whether or not we want to stick 28 // are deleted, we should consider whether or not we want to stick
33 // to this style and deprecate the other constructors. 29 // to this style and deprecate the other constructors.
34 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, 30 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
35 webrtc::VideoRotation rotation, 31 webrtc::VideoRotation rotation,
36 int64_t timestamp_us); 32 int64_t timestamp_us);
37 33
38 // Preferred constructor. 34 // Preferred constructor.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Set render time in milliseconds. 95 // Set render time in milliseconds.
100 void set_render_time_ms(int64_t render_time_ms) { 96 void set_render_time_ms(int64_t render_time_ms) {
101 set_timestamp_us(render_time_ms * rtc::kNumMicrosecsPerMillisec);; 97 set_timestamp_us(render_time_ms * rtc::kNumMicrosecsPerMillisec);;
102 } 98 }
103 99
104 // Get render time in milliseconds. 100 // Get render time in milliseconds.
105 int64_t render_time_ms() const { 101 int64_t render_time_ms() const {
106 return timestamp_us() / rtc::kNumMicrosecsPerMillisec; 102 return timestamp_us() / rtc::kNumMicrosecsPerMillisec;
107 } 103 }
108 104
109 // Return true if and only if video_frame_buffer() is null. Which is possible
110 // only if the object was default-constructed.
111 // TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and
112 // webrtc::VideoFrame merge. The intention is that video_frame_buffer() never
113 // should return nullptr. To handle potentially uninitialized or non-existent
114 // frames, consider using rtc::Optional. Otherwise, IsZeroSize() can be
115 // replaced by video_frame_buffer() == nullptr.
116 bool IsZeroSize() const;
117
118 // Return the underlying buffer. Never nullptr for a properly 105 // Return the underlying buffer. Never nullptr for a properly
119 // initialized VideoFrame. 106 // initialized VideoFrame.
120 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; 107 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const;
121 108
122 // Return true if the frame is stored in a texture. 109 // Return true if the frame is stored in a texture.
123 bool is_texture() const { 110 bool is_texture() const {
124 return video_frame_buffer() && 111 return video_frame_buffer() &&
125 video_frame_buffer()->native_handle() != nullptr; 112 video_frame_buffer()->native_handle() != nullptr;
126 } 113 }
127 114
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 int qp_ = -1; // Quantizer value. 164 int qp_ = -1; // Quantizer value.
178 165
179 // When an application indicates non-zero values here, it is taken as an 166 // When an application indicates non-zero values here, it is taken as an
180 // indication that all future frames will be constrained with those limits 167 // indication that all future frames will be constrained with those limits
181 // until the application indicates a change again. 168 // until the application indicates a change again.
182 PlayoutDelay playout_delay_ = {-1, -1}; 169 PlayoutDelay playout_delay_ = {-1, -1};
183 }; 170 };
184 171
185 } // namespace webrtc 172 } // namespace webrtc
186 #endif // WEBRTC_VIDEO_FRAME_H_ 173 #endif // WEBRTC_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « webrtc/video/vie_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698