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

RTMP: Do not response publish start message if hooks fail. v5.0.212 v6.0.123 (#4038)

Fix #4037 SRS should not send the publish start message
`onStatus(NetStream.Publish.Start)` if hooks fail, which causes OBS to
repeatedly reconnect.

Note that this fix does not send an RTMP error message when publishing
fails, because neither OBS nor FFmpeg process this specific error
message; they only display a general error.

Apart from the order of messages, nothing else has been changed.
Previously, we sent the publish start message
`onStatus(NetStream.Publish.Start)` before the HTTP hook `on_publish`;
now, we have modified it to send this message after the HTTP hook.
This commit is contained in:
Winlin 2024-04-23 15:21:36 +08:00 committed by GitHub
parent 5eb802daca
commit 37f0faae5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 38 additions and 31 deletions

View file

@ -1002,6 +1002,11 @@ srs_error_t SrsRtmpConn::do_publishing(SrsLiveSource* source, SrsPublishRecvThre
->attr("timeout", srs_fmt("%d", srsu2msi(publish_normal_timeout)))->end();
SrsAutoFree(ISrsApmSpan, span);
#endif
// Response the start publishing message, let client start to publish messages.
if ((err = rtmp->start_publishing(info->res->stream_id)) != srs_success) {
return srs_error_wrap(err, "start publishing");
}
int64_t nb_msgs = 0;
uint64_t nb_frames = 0;