winlin

fix #433, fix the sps parse bug. 2.0.176

@@ -344,6 +344,7 @@ Remark: @@ -344,6 +344,7 @@ Remark:
344 344
345 ### SRS 2.0 history 345 ### SRS 2.0 history
346 346
  347 +* v2.0, 2015-07-01, fix [#433](https://github.com/simple-rtmp-server/srs/issues/433) fix the sps parse bug. 2.0.176
347 * v2.0, 2015-06-10, fix [#425](https://github.com/simple-rtmp-server/srs/issues/425) refine the time jitter, correct (-inf,-250)+(250,+inf) to 10ms. 2.0.175 348 * v2.0, 2015-06-10, fix [#425](https://github.com/simple-rtmp-server/srs/issues/425) refine the time jitter, correct (-inf,-250)+(250,+inf) to 10ms. 2.0.175
348 * v2.0, 2015-06-10, fix [#424](https://github.com/simple-rtmp-server/srs/issues/424) fix aggregate timestamp bug. 2.0.174 349 * v2.0, 2015-06-10, fix [#424](https://github.com/simple-rtmp-server/srs/issues/424) fix aggregate timestamp bug. 2.0.174
349 * v2.0, 2015-06-06, fix [#421](https://github.com/simple-rtmp-server/srs/issues/421) drop video for unkown RTMP header. 350 * v2.0, 2015-06-06, fix [#421](https://github.com/simple-rtmp-server/srs/issues/421) drop video for unkown RTMP header.
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 175 34 +#define VERSION_REVISION 176
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -981,11 +981,11 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp) @@ -981,11 +981,11 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
981 } 981 }
982 srs_info("sps parse profile=%d, level=%d, sps_id=%d", profile_idc, level_idc, seq_parameter_set_id); 982 srs_info("sps parse profile=%d, level=%d, sps_id=%d", profile_idc, level_idc, seq_parameter_set_id);
983 983
  984 + int32_t chroma_format_idc = -1;
984 if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || profile_idc == 244 985 if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || profile_idc == 244
985 || profile_idc == 44 || profile_idc == 83 || profile_idc == 86 || profile_idc == 118 986 || profile_idc == 44 || profile_idc == 83 || profile_idc == 86 || profile_idc == 118
986 || profile_idc == 128 987 || profile_idc == 128
987 ) { 988 ) {
988 - int32_t chroma_format_idc = -1;  
989 if ((ret = srs_avc_nalu_read_uev(&bs, chroma_format_idc)) != ERROR_SUCCESS) { 989 if ((ret = srs_avc_nalu_read_uev(&bs, chroma_format_idc)) != ERROR_SUCCESS) {
990 return ret; 990 return ret;
991 } 991 }
@@ -1016,11 +1016,20 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp) @@ -1016,11 +1016,20 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
1016 return ret; 1016 return ret;
1017 } 1017 }
1018 if (seq_scaling_matrix_present_flag) { 1018 if (seq_scaling_matrix_present_flag) {
  1019 + int nb_scmpfs = ((chroma_format_idc != 3)? 8:12);
  1020 + for (int i = 0; i < nb_scmpfs; i++) {
  1021 + int8_t seq_scaling_matrix_present_flag_i = -1;
  1022 + if ((ret = srs_avc_nalu_read_bit(&bs, seq_scaling_matrix_present_flag_i)) != ERROR_SUCCESS) {
  1023 + return ret;
  1024 + }
  1025 + if (seq_scaling_matrix_present_flag_i) {
1019 ret = ERROR_HLS_DECODE_ERROR; 1026 ret = ERROR_HLS_DECODE_ERROR;
1020 - srs_error("sps the seq_scaling_matrix_present_flag invalid. ret=%d", ret); 1027 + srs_error("sps the seq_scaling_matrix_present_flag invalid, i=%d, nb_scmpfs=%d. ret=%d", i, nb_scmpfs, ret);
1021 return ret; 1028 return ret;
1022 } 1029 }
1023 } 1030 }
  1031 + }
  1032 + }
1024 1033
1025 int32_t log2_max_frame_num_minus4 = -1; 1034 int32_t log2_max_frame_num_minus4 = -1;
1026 if ((ret = srs_avc_nalu_read_uev(&bs, log2_max_frame_num_minus4)) != ERROR_SUCCESS) { 1035 if ((ret = srs_avc_nalu_read_uev(&bs, log2_max_frame_num_minus4)) != ERROR_SUCCESS) {