Edge: Fix RTMP late-join missing sequence headers. v6.0.186 (#4678)

Backport of the RTMP late-join fix from v8.0.2 / v7.0.150 to the 6.0
release line. The HTTP-FLV inverted-guard bug from that fix does not
apply to v6 (the lazy edge-mount mechanism that introduced it does not
exist on this branch).

RTMP players that join an edge stream after the first player fail to
decode. After v6.0.179 (#4512) stopped creating SrsOriginHub on edge,
the hub_active gate in SrsLiveSource::consumer_dumps() always evaluated
false on edge. That gate guards the dump of cached onMetaData + AVC
sequence header + AAC sequence header + GOP cache to a new consumer.
Result: the first player attaches before the edge-pull starts and gets
headers via the live fan-out, but every subsequent player gets coded
payload with no codec config and ffmpeg aborts with `dimensions not set`
/ `Could not write header`. Fall back to the meta cache state when hub
is NULL, so the dump path runs once the edge-pull has populated the
cache. (trunk/src/app/srs_app_source.cpp)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
winlin 2026-05-19 11:33:42 -04:00
parent 480d6d5f5a
commit 398620d52c
3 changed files with 6 additions and 2 deletions

View File

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v6-changes"></a>
## SRS 6.0 Changelog
* v6.0, 2026-05-19, Merge [#4678](https://github.com/ossrs/srs/pull/4678): Edge: Fix RTMP late-join missing sequence headers. v6.0.186 (#4678)
* v6.0, 2025-12-06, Merge [#4605](https://github.com/ossrs/srs/pull/4605): DVR: Fix HEVC mp4 recording error. v6.0.185 (#4605)
* v6.0, 2025-12-03, Merge [#4588](https://github.com/ossrs/srs/pull/4588): RTMP: Ignore FMLE start packet after flash publish. v6.0.184 (#4588)
* v6.0, 2025-10-21, Merge [#4535](https://github.com/ossrs/srs/issues/4535): Bridge: Fix heap-use-after-free in SrsCompositeBridge iterator. v6.0.183 (#4535)

View File

@ -2721,7 +2721,10 @@ srs_error_t SrsLiveSource::consumer_dumps(SrsLiveConsumer* consumer, bool ds, bo
}
// If stream is publishing, dumps the sequence header and gop cache.
bool hub_active = hub ? hub->active() : false;
// On edge, hub is NULL; the source is "publishing" once the edge-pull has
// populated the meta cache. Late-joining consumers must still receive the
// cached metadata + sequence headers + GOP via this path.
bool hub_active = hub ? hub->active() : (meta->data() || meta->vsh() || meta->ash());
if (hub_active) {
// Copy metadata and sequence header to consumer.
if ((err = meta->dumps(consumer, atc, jitter_algorithm, dm, ds)) != srs_success) {

View File

@ -9,6 +9,6 @@
#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 185
#define VERSION_REVISION 186
#endif