fix #380, srs-librtmp send sequence header when sps or pps changed.
正在显示
2 个修改的文件
包含
10 行增加
和
4 行删除
| @@ -342,6 +342,7 @@ Remark: | @@ -342,6 +342,7 @@ Remark: | ||
| 342 | 342 | ||
| 343 | ## History | 343 | ## History |
| 344 | 344 | ||
| 345 | +* 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. | ||
| 345 | * v2.0, 2015-08-18, close [#454](https://github.com/simple-rtmp-server/srs/issues/454), support obs restart publish. 2.0.184 | 346 | * v2.0, 2015-08-18, close [#454](https://github.com/simple-rtmp-server/srs/issues/454), support obs restart publish. 2.0.184 |
| 346 | * v2.0, 2015-08-14, use reduce_sequence_header for stream control. | 347 | * v2.0, 2015-08-14, use reduce_sequence_header for stream control. |
| 347 | * v2.0, 2015-08-14, use send_min_interval for stream control. 2.0.183 | 348 | * v2.0, 2015-08-14, use send_min_interval for stream control. 2.0.183 |
| @@ -1279,8 +1279,8 @@ int srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts) | @@ -1279,8 +1279,8 @@ int srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts) | ||
| 1279 | { | 1279 | { |
| 1280 | int ret = ERROR_SUCCESS; | 1280 | int ret = ERROR_SUCCESS; |
| 1281 | 1281 | ||
| 1282 | - // only send when both sps and pps changed. | ||
| 1283 | - if (!context->h264_sps_changed || !context->h264_pps_changed) { | 1282 | + // send when sps or pps changed. |
| 1283 | + if (!context->h264_sps_changed && !context->h264_pps_changed) { | ||
| 1284 | return ret; | 1284 | return ret; |
| 1285 | } | 1285 | } |
| 1286 | 1286 | ||
| @@ -1330,7 +1330,7 @@ int srs_write_h264_raw_frame(Context* context, | @@ -1330,7 +1330,7 @@ int srs_write_h264_raw_frame(Context* context, | ||
| 1330 | context->h264_sps_changed = true; | 1330 | context->h264_sps_changed = true; |
| 1331 | context->h264_sps = sps; | 1331 | context->h264_sps = sps; |
| 1332 | 1332 | ||
| 1333 | - return srs_write_h264_sps_pps(context, dts, pts); | 1333 | + return ret; |
| 1334 | } | 1334 | } |
| 1335 | 1335 | ||
| 1336 | // for pps | 1336 | // for pps |
| @@ -1346,7 +1346,12 @@ int srs_write_h264_raw_frame(Context* context, | @@ -1346,7 +1346,12 @@ int srs_write_h264_raw_frame(Context* context, | ||
| 1346 | context->h264_pps_changed = true; | 1346 | context->h264_pps_changed = true; |
| 1347 | context->h264_pps = pps; | 1347 | context->h264_pps = pps; |
| 1348 | 1348 | ||
| 1349 | - return srs_write_h264_sps_pps(context, dts, pts); | 1349 | + return ret; |
| 1350 | + } | ||
| 1351 | + | ||
| 1352 | + // send pps+sps before ipb frames when sps/pps changed. | ||
| 1353 | + if ((ret = srs_write_h264_sps_pps(context, dts, pts)) != ERROR_SUCCESS) { | ||
| 1354 | + return ret; | ||
| 1350 | } | 1355 | } |
| 1351 | 1356 | ||
| 1352 | // ibp frame. | 1357 | // ibp frame. |
-
请 注册 或 登录 后发表评论