Skip to content

Commit 4101900

Browse files
RTMP: Ignore FMLE start packet after flash publish. v7.0.129 (#4588)
We have discovered that some IP cameras send two publish packets in a row. The first packet is flash publish `publish('xxx')` The second packet is FMLE publish `FCPublish('xxx|@setDataFrame()` It seems that this is not processed correctly on the SRS side. In fact, the stream is simply deinitialized, and republish is simply not supported in this case. As a fix, I suggest simply ignoring the FMLE publish packet after the flash publish. <img width="720" alt="screen" src="https://github.com/user-attachments/assets/2db806ab-71b9-4e7b-bcf9-c16ea12df671" />
1 parent e59b303 commit 4101900

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

trunk/doc/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The changelog for SRS.
77
<a name="v7-changes"></a>
88

99
## SRS 7.0 Changelog
10+
* v7.0, 2025-11-27, Merge [#4588](https://github.com/ossrs/srs/pull/4588): RTMP: Ignore FMLE start packet after flash publish. v7.0.129 (#4588)
1011
* v7.0, 2025-11-18, AI: API: Change pagination default count to 10, minimum 1. v7.0.128
1112
* v7.0, 2025-11-14, AI: Fix race condition causing immediate deletion of new sources. v7.0.127 (#4449)
1213
* v7.0, 2025-11-11, AI: WebRTC: Support optional msid attribute per RFC 8830. v7.0.126 (#4570)

trunk/src/app/srs_app_rtc_conn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3604,8 +3604,8 @@ srs_error_t SrsRtcPublisherNegotiator::negotiate_publish_capability(SrsRtcUserCo
36043604
// Generate msid because it's optional in sdp.
36053605
string msid_tracker = ssrc_info.msid_tracker_;
36063606
if (msid_tracker.empty()) {
3607-
msid_tracker = srs_fmt_sprintf("track-%s-%s-%d",
3608-
track_desc->type_.c_str(), ssrc_info.cname_.c_str(), ssrc_info.ssrc_);
3607+
msid_tracker = srs_fmt_sprintf("track-%s-%s-%d",
3608+
track_desc->type_.c_str(), ssrc_info.cname_.c_str(), ssrc_info.ssrc_);
36093609
}
36103610

36113611
// Generate msid because it's optional in sdp.

trunk/src/app/srs_app_rtmp_conn.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,11 @@ srs_error_t SrsRtmpConn::handle_publish_message(SrsSharedPtr<SrsLiveSource> &sou
11761176

11771177
// for flash, any packet is republish.
11781178
if (info_->type_ == SrsRtmpConnFlashPublish) {
1179+
if (dynamic_cast<SrsFMLEStartPacket *>(pkt.get())) {
1180+
srs_warn("flash late FMLE start packet");
1181+
return err;
1182+
}
1183+
11791184
// flash unpublish.
11801185
// TODO: maybe need to support republish.
11811186
srs_trace("flash flash publish finished.");

trunk/src/core/srs_core_version7.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
#define VERSION_MAJOR 7
1111
#define VERSION_MINOR 0
12-
#define VERSION_REVISION 128
12+
#define VERSION_REVISION 129
1313

1414
#endif

trunk/src/utest/srs_utest_ai24.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include <srs_kernel_utility.hpp>
2121
#include <srs_protocol_sdp.hpp>
2222
#include <srs_protocol_utility.hpp>
23+
#include <srs_utest_ai16.hpp>
2324
#include <srs_utest_manual_kernel.hpp>
2425
#include <srs_utest_manual_mock.hpp>
25-
#include <srs_utest_ai16.hpp>
2626

2727
#ifdef SRS_FFMPEG_FIT
2828
#include <srs_app_rtc_codec.hpp>
@@ -1241,7 +1241,7 @@ VOID TEST(SdpTest, ParseLibdatachannelSdpFromIssue4570)
12411241
EXPECT_TRUE(sdp.media_descs_.size() == 2);
12421242

12431243
// Verify first media description is video
1244-
SrsMediaDesc* video_desc = &sdp.media_descs_[0];
1244+
SrsMediaDesc *video_desc = &sdp.media_descs_[0];
12451245
EXPECT_TRUE(video_desc->type_ == "video");
12461246
EXPECT_TRUE(video_desc->mid_ == "video");
12471247
EXPECT_TRUE(video_desc->sendonly_);
@@ -1253,7 +1253,7 @@ VOID TEST(SdpTest, ParseLibdatachannelSdpFromIssue4570)
12531253
EXPECT_TRUE(video_desc->payload_types_.size() >= 1);
12541254

12551255
// Find H264 payload (PT 96)
1256-
SrsMediaPayloadType* h264_payload = NULL;
1256+
SrsMediaPayloadType *h264_payload = NULL;
12571257
for (size_t i = 0; i < video_desc->payload_types_.size(); i++) {
12581258
if (video_desc->payload_types_[i].payload_type_ == 96) {
12591259
h264_payload = &video_desc->payload_types_[i];
@@ -1277,7 +1277,7 @@ VOID TEST(SdpTest, ParseLibdatachannelSdpFromIssue4570)
12771277
EXPECT_TRUE(found_video_ssrc);
12781278

12791279
// Verify second media description is audio
1280-
SrsMediaDesc* audio_desc = &sdp.media_descs_[1];
1280+
SrsMediaDesc *audio_desc = &sdp.media_descs_[1];
12811281
EXPECT_TRUE(audio_desc->type_ == "audio");
12821282
EXPECT_TRUE(audio_desc->mid_ == "audio");
12831283
EXPECT_TRUE(audio_desc->sendonly_);
@@ -1289,7 +1289,7 @@ VOID TEST(SdpTest, ParseLibdatachannelSdpFromIssue4570)
12891289
EXPECT_TRUE(audio_desc->payload_types_.size() >= 1);
12901290

12911291
// Find Opus payload (PT 111)
1292-
SrsMediaPayloadType* opus_payload = NULL;
1292+
SrsMediaPayloadType *opus_payload = NULL;
12931293
for (size_t i = 0; i < audio_desc->payload_types_.size(); i++) {
12941294
if (audio_desc->payload_types_[i].payload_type_ == 111) {
12951295
opus_payload = &audio_desc->payload_types_[i];

0 commit comments

Comments
 (0)