weiyabo
Committed by winlin

for bug #5064, success parse 264 sps

@@ -1040,11 +1040,6 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp) @@ -1040,11 +1040,6 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
1040 if ((ret = srs_avc_nalu_read_bit(&bs, seq_scaling_matrix_present_flag_i)) != ERROR_SUCCESS) { 1040 if ((ret = srs_avc_nalu_read_bit(&bs, seq_scaling_matrix_present_flag_i)) != ERROR_SUCCESS) {
1041 return ret; 1041 return ret;
1042 } 1042 }
1043 - if (seq_scaling_matrix_present_flag_i) {  
1044 - ret = ERROR_HLS_DECODE_ERROR;  
1045 - srs_error("sps the seq_scaling_matrix_present_flag invalid, i=%d, nb_scmpfs=%d. ret=%d", i, nb_scmpfs, ret);  
1046 - return ret;  
1047 - }  
1048 } 1043 }
1049 } 1044 }
1050 } 1045 }
@@ -1084,11 +1079,17 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp) @@ -1084,11 +1079,17 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
1084 if ((ret = srs_avc_nalu_read_uev(&bs, num_ref_frames_in_pic_order_cnt_cycle)) != ERROR_SUCCESS) { 1079 if ((ret = srs_avc_nalu_read_uev(&bs, num_ref_frames_in_pic_order_cnt_cycle)) != ERROR_SUCCESS) {
1085 return ret; 1080 return ret;
1086 } 1081 }
1087 - if (num_ref_frames_in_pic_order_cnt_cycle) { 1082 + if (num_ref_frames_in_pic_order_cnt_cycle < 0) {
1088 ret = ERROR_HLS_DECODE_ERROR; 1083 ret = ERROR_HLS_DECODE_ERROR;
1089 srs_error("sps the num_ref_frames_in_pic_order_cnt_cycle invalid. ret=%d", ret); 1084 srs_error("sps the num_ref_frames_in_pic_order_cnt_cycle invalid. ret=%d", ret);
1090 return ret; 1085 return ret;
1091 } 1086 }
  1087 + for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
  1088 + int32_t offset_for_ref_frame_i = -1;
  1089 + if ((ret = srs_avc_nalu_read_uev(&bs, offset_for_ref_frame_i)) != ERROR_SUCCESS) {
  1090 + return ret;
  1091 + }
  1092 + }
1092 } 1093 }
1093 1094
1094 int32_t max_num_ref_frames = -1; 1095 int32_t max_num_ref_frames = -1;
@@ -75,7 +75,7 @@ int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v) @@ -75,7 +75,7 @@ int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v)
75 v = (1 << leadingZeroBits) - 1; 75 v = (1 << leadingZeroBits) - 1;
76 for (int i = 0; i < leadingZeroBits; i++) { 76 for (int i = 0; i < leadingZeroBits; i++) {
77 int32_t b = stream->read_bit(); 77 int32_t b = stream->read_bit();
78 - v += b << (leadingZeroBits - 1); 78 + v += b << (leadingZeroBits - 1 - i);
79 } 79 }
80 80
81 return ret; 81 return ret;