OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 dst->video_frame_buffer()->StrideY(), | 141 dst->video_frame_buffer()->StrideY(), |
142 dst->video_frame_buffer()->StrideU(), | 142 dst->video_frame_buffer()->StrideU(), |
143 dst->video_frame_buffer()->StrideV(), | 143 dst->video_frame_buffer()->StrideV(), |
144 dst->width(), dst->height(), | 144 dst->width(), dst->height(), |
145 interpolate, vert_crop); | 145 interpolate, vert_crop); |
146 dst->SetTimeStamp(GetTimeStamp()); | 146 dst->SetTimeStamp(GetTimeStamp()); |
147 // Stretched frame should have the same rotation as the source. | 147 // Stretched frame should have the same rotation as the source. |
148 dst->set_rotation(rotation()); | 148 dst->set_rotation(rotation()); |
149 } | 149 } |
150 | 150 |
151 bool VideoFrame::SetToBlack() { | |
152 return libyuv::I420Rect(video_frame_buffer()->MutableDataY(), | |
153 video_frame_buffer()->StrideY(), | |
154 video_frame_buffer()->MutableDataU(), | |
155 video_frame_buffer()->StrideU(), | |
156 video_frame_buffer()->MutableDataV(), | |
157 video_frame_buffer()->StrideV(), | |
158 0, 0, | |
159 width(), height(), | |
160 16, 128, 128) == 0; | |
161 } | |
162 | |
163 static const size_t kMaxSampleSize = 1000000000u; | 151 static const size_t kMaxSampleSize = 1000000000u; |
164 // Returns whether a sample is valid. | 152 // Returns whether a sample is valid. |
165 bool VideoFrame::Validate(uint32_t fourcc, | 153 bool VideoFrame::Validate(uint32_t fourcc, |
166 int w, | 154 int w, |
167 int h, | 155 int h, |
168 const uint8_t* sample, | 156 const uint8_t* sample, |
169 size_t sample_size) { | 157 size_t sample_size) { |
170 if (h < 0) { | 158 if (h < 0) { |
171 h = -h; | 159 h = -h; |
172 } | 160 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 << " expected: " << expected_size | 291 << " expected: " << expected_size |
304 << " sample[0..3]: " << static_cast<int>(four_samples[0]) | 292 << " sample[0..3]: " << static_cast<int>(four_samples[0]) |
305 << ", " << static_cast<int>(four_samples[1]) | 293 << ", " << static_cast<int>(four_samples[1]) |
306 << ", " << static_cast<int>(four_samples[2]) | 294 << ", " << static_cast<int>(four_samples[2]) |
307 << ", " << static_cast<int>(four_samples[3]); | 295 << ", " << static_cast<int>(four_samples[3]); |
308 } | 296 } |
309 return true; | 297 return true; |
310 } | 298 } |
311 | 299 |
312 } // namespace cricket | 300 } // namespace cricket |
OLD | NEW |