OLD | NEW |
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 |
25 // TODO(nisse): This constructor is consistent with | 29 // TODO(nisse): This constructor is consistent with |
26 // cricket::WebRtcVideoFrame. After the class | 30 // cricket::WebRtcVideoFrame. After the class |
27 // cricket::WebRtcVideoFrame and its baseclass cricket::VideoFrame | 31 // cricket::WebRtcVideoFrame and its baseclass cricket::VideoFrame |
28 // are deleted, we should consider whether or not we want to stick | 32 // are deleted, we should consider whether or not we want to stick |
29 // to this style and deprecate the other constructors. | 33 // to this style and deprecate the other constructors. |
30 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 34 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
31 webrtc::VideoRotation rotation, | 35 webrtc::VideoRotation rotation, |
32 int64_t timestamp_us); | 36 int64_t timestamp_us); |
33 | 37 |
34 // Preferred constructor. | 38 // Preferred constructor. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Set render time in milliseconds. | 99 // Set render time in milliseconds. |
96 void set_render_time_ms(int64_t render_time_ms) { | 100 void set_render_time_ms(int64_t render_time_ms) { |
97 set_timestamp_us(render_time_ms * rtc::kNumMicrosecsPerMillisec);; | 101 set_timestamp_us(render_time_ms * rtc::kNumMicrosecsPerMillisec);; |
98 } | 102 } |
99 | 103 |
100 // Get render time in milliseconds. | 104 // Get render time in milliseconds. |
101 int64_t render_time_ms() const { | 105 int64_t render_time_ms() const { |
102 return timestamp_us() / rtc::kNumMicrosecsPerMillisec; | 106 return timestamp_us() / rtc::kNumMicrosecsPerMillisec; |
103 } | 107 } |
104 | 108 |
| 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 |
105 // Return the underlying buffer. Never nullptr for a properly | 118 // Return the underlying buffer. Never nullptr for a properly |
106 // initialized VideoFrame. | 119 // initialized VideoFrame. |
107 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; | 120 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; |
108 | 121 |
109 // Return true if the frame is stored in a texture. | 122 // Return true if the frame is stored in a texture. |
110 bool is_texture() const { | 123 bool is_texture() const { |
111 return video_frame_buffer() && | 124 return video_frame_buffer() && |
112 video_frame_buffer()->native_handle() != nullptr; | 125 video_frame_buffer()->native_handle() != nullptr; |
113 } | 126 } |
114 | 127 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 int qp_ = -1; // Quantizer value. | 177 int qp_ = -1; // Quantizer value. |
165 | 178 |
166 // When an application indicates non-zero values here, it is taken as an | 179 // When an application indicates non-zero values here, it is taken as an |
167 // indication that all future frames will be constrained with those limits | 180 // indication that all future frames will be constrained with those limits |
168 // until the application indicates a change again. | 181 // until the application indicates a change again. |
169 PlayoutDelay playout_delay_ = {-1, -1}; | 182 PlayoutDelay playout_delay_ = {-1, -1}; |
170 }; | 183 }; |
171 | 184 |
172 } // namespace webrtc | 185 } // namespace webrtc |
173 #endif // WEBRTC_VIDEO_FRAME_H_ | 186 #endif // WEBRTC_VIDEO_FRAME_H_ |
OLD | NEW |