Index: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc |
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc |
index b0c4bd326d45e8c584a424273e788bea5e62e0d1..b03a72382755d65dec70862b2816a5b66f35c24c 100644 |
--- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc |
+++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc |
@@ -255,7 +255,15 @@ bool H264AnnexBBufferHasVideoFormatDescription(const uint8_t* annexb_buffer, |
// separately. |
uint8_t first_nalu_type = annexb_buffer[4] & 0x1f; |
bool is_first_nalu_type_sps = first_nalu_type == 0x7; |
- return is_first_nalu_type_sps; |
+ if (is_first_nalu_type_sps) |
+ return true; |
+ bool is_first_nalu_type_delimiter = first_nalu_type == 0x9; |
+ // start code + access unit delimiter + start code = 4 + 2 + 4 = 10 |
tkchin_webrtc
2016/08/04 16:49:05
nit: caps and period // Start code .... = 10. Here
jianjunz
2016/08/05 06:35:32
Done.
|
+ if (!is_first_nalu_type_delimiter || annexb_buffer_size <= 10u) |
+ return false; |
+ uint8_t second_nalu_type = annexb_buffer[10] & 0x1f; |
+ bool is_second_nalu_type_sps = second_nalu_type == 0x7; |
+ return is_second_nalu_type_sps; |
} |
CMVideoFormatDescriptionRef CreateVideoFormatDescription( |
@@ -271,6 +279,13 @@ CMVideoFormatDescriptionRef CreateVideoFormatDescription( |
// Parse the SPS and PPS into a CMVideoFormatDescription. |
const uint8_t* param_set_ptrs[2] = {}; |
size_t param_set_sizes[2] = {}; |
+ // Skip AUD |
+ if ((annexb_buffer[4] & 0x1f) == 0x9) { |
tkchin_webrtc
2016/08/04 16:49:05
suggest having enum for types, and function that r
jianjunz
2016/08/05 06:35:32
Included "webrtc/common_video/h264/h264_common.h"
|
+ if (!reader.ReadNalu(¶m_set_ptrs[0], ¶m_set_sizes[0])) { |
+ LOG(LS_ERROR) << "Failed to read AUD"; |
+ return nullptr; |
+ } |
+ } |
if (!reader.ReadNalu(¶m_set_ptrs[0], ¶m_set_sizes[0])) { |
LOG(LS_ERROR) << "Failed to read SPS"; |
return nullptr; |