diff --git a/README.md b/README.md index 896bf474a..3c89f899e 100755 --- a/README.md +++ b/README.md @@ -342,6 +342,7 @@ Remark: ## History +* v2.0, 2015-08-20, fix [#380](https://github.com/simple-rtmp-server/srs/issues/380), srs-librtmp send sequence header when sps or pps changed. * v2.0, 2015-08-18, close [#454](https://github.com/simple-rtmp-server/srs/issues/454), support obs restart publish. 2.0.184 * v2.0, 2015-08-14, use reduce_sequence_header for stream control. * v2.0, 2015-08-14, use send_min_interval for stream control. 2.0.183 diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index db2536ca9..21851bcdb 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -1279,8 +1279,8 @@ int srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts) { int ret = ERROR_SUCCESS; - // only send when both sps and pps changed. - if (!context->h264_sps_changed || !context->h264_pps_changed) { + // send when sps or pps changed. + if (!context->h264_sps_changed && !context->h264_pps_changed) { return ret; } @@ -1330,7 +1330,7 @@ int srs_write_h264_raw_frame(Context* context, context->h264_sps_changed = true; context->h264_sps = sps; - return srs_write_h264_sps_pps(context, dts, pts); + return ret; } // for pps @@ -1346,7 +1346,12 @@ int srs_write_h264_raw_frame(Context* context, context->h264_pps_changed = true; context->h264_pps = pps; - return srs_write_h264_sps_pps(context, dts, pts); + return ret; + } + + // send pps+sps before ipb frames when sps/pps changed. + if ((ret = srs_write_h264_sps_pps(context, dts, pts)) != ERROR_SUCCESS) { + return ret; } // ibp frame.