OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 | 257 |
258 // The buffer we receive via RTP has 00 00 00 01 start code artifically | 258 // The buffer we receive via RTP has 00 00 00 01 start code artifically |
259 // embedded by the RTP depacketizer. Extract NALU information. | 259 // embedded by the RTP depacketizer. Extract NALU information. |
260 // TODO(tkchin): handle potential case where sps and pps are delivered | 260 // TODO(tkchin): handle potential case where sps and pps are delivered |
261 // separately. | 261 // separately. |
262 NaluType first_nalu_type = ParseNaluType(annexb_buffer[4]); | 262 NaluType first_nalu_type = ParseNaluType(annexb_buffer[4]); |
263 bool is_first_nalu_type_sps = first_nalu_type == kSps; | 263 bool is_first_nalu_type_sps = first_nalu_type == kSps; |
264 if (is_first_nalu_type_sps) | 264 if (is_first_nalu_type_sps) |
265 return true; | 265 return true; |
266 bool is_first_nalu_type_aud = first_nalu_type == kAud; | 266 bool is_first_nalu_type_aud = first_nalu_type == kAud; |
267 // Start code + access unit delimiter + start code = 4 + 2 + 4 = 10. | 267 // Start code + access unit delimiter + start code = 4 + 1 + 4 = 9. |
tkchin_webrtc
2016/09/28 10:35:02
I looked and I think that 10 is correct
start code
kthelgason
2016/09/28 10:46:45
You're right, I forgot to count the type byte. Add
| |
268 if (!is_first_nalu_type_aud || annexb_buffer_size <= 10u) | 268 if (!is_first_nalu_type_aud || annexb_buffer_size <= 9u) |
269 return false; | 269 return false; |
270 NaluType second_nalu_type = ParseNaluType(annexb_buffer[10]); | 270 NaluType second_nalu_type = ParseNaluType(annexb_buffer[9]); |
271 bool is_second_nalu_type_sps = second_nalu_type == kSps; | 271 bool is_second_nalu_type_sps = second_nalu_type == kSps; |
272 return is_second_nalu_type_sps; | 272 return is_second_nalu_type_sps; |
273 } | 273 } |
274 | 274 |
275 CMVideoFormatDescriptionRef CreateVideoFormatDescription( | 275 CMVideoFormatDescriptionRef CreateVideoFormatDescription( |
276 const uint8_t* annexb_buffer, | 276 const uint8_t* annexb_buffer, |
277 size_t annexb_buffer_size) { | 277 size_t annexb_buffer_size) { |
278 if (!H264AnnexBBufferHasVideoFormatDescription(annexb_buffer, | 278 if (!H264AnnexBBufferHasVideoFormatDescription(annexb_buffer, |
279 annexb_buffer_size)) { | 279 annexb_buffer_size)) { |
280 return nullptr; | 280 return nullptr; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 return true; | 388 return true; |
389 } | 389 } |
390 | 390 |
391 size_t AvccBufferWriter::BytesRemaining() const { | 391 size_t AvccBufferWriter::BytesRemaining() const { |
392 return length_ - offset_; | 392 return length_ - offset_; |
393 } | 393 } |
394 | 394 |
395 } // namespace webrtc | 395 } // namespace webrtc |
396 | 396 |
397 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 397 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |