1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Fix #3767: RTMP: Do not response empty data packet. v6.0.153 (#4162)

If SRS responds with this empty data packet, FFmpeg will receive an
empty stream, like `Stream #0:0: Data: none` in following logs:

```bash
ffmpeg -i rtmp://localhost:11935/live/livestream
```

This won't cause the player to fail, but it will inconvenience the user
significantly. It may also cause FFmpeg slower to analysis the stream,
see #3767

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
This commit is contained in:
Winlin 2024-09-01 06:40:16 +08:00 committed by winlin
parent d27e530f84
commit 0bac21df6e
3 changed files with 4 additions and 2 deletions

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 152
#define VERSION_REVISION 153
#endif

View file

@ -2569,7 +2569,8 @@ srs_error_t SrsRtmpServer::start_play(int stream_id)
}
// onStatus(NetStream.Data.Start)
if (true) {
// We should not response this packet, or there is an empty stream "Stream #0:0: Data: none" in FFmpeg.
if (false) {
SrsOnStatusDataPacket* pkt = new SrsOnStatusDataPacket();
pkt->data->set(StatusCode, SrsAmf0Any::str(StatusCodeDataStart));
if ((err = protocol->send_and_free_packet(pkt, stream_id)) != srs_success) {