diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index f1f210bd..8b7a1b61 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -67,12 +67,12 @@ ProtocolOption::ProtocolOption() { ////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct MediaSourceNull : public MediaSource { - MediaSourceNull() : MediaSource("schema", MediaTuple{"vhost", "app", "stream", ""}) {}; + MediaSourceNull(const MediaTuple &tuple) : MediaSource("schema", tuple) {}; int readerCount() override { return 0; } }; -MediaSource &MediaSource::NullMediaSource() { - static std::shared_ptr s_null = std::make_shared(); +MediaSource &MediaSource::NullMediaSource(const MediaTuple &tuple) { + static std::shared_ptr s_null = std::make_shared(tuple); return *s_null; } diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index fc7f77d2..621c859e 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -397,7 +397,8 @@ bool equalMediaTuple(const MediaTuple& a, const MediaTuple& b); */ class MediaSource: public TrackSource, public std::enable_shared_from_this { public: - static MediaSource& NullMediaSource(); + static MediaSource &NullMediaSource(const MediaTuple &tuple = {"vhost", "app", "stream" }); + using Ptr = std::shared_ptr; MediaSource(const std::string &schema, const MediaTuple& tuple); diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index 52a6705d..4c1f10eb 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -319,7 +319,7 @@ bool MultiMediaSourceMuxer::setupRecord(Recorder::type type, bool start, const s if (_option.mp4_as_player && type == Recorder::type_mp4) { // 开启关闭mp4录制,触发观看人数变化相关事件 [AUTO-TRANSLATED:b63a8deb] // Turn on/off mp4 recording, trigger events related to changes in the number of viewers - onReaderChanged(MediaSource::NullMediaSource(), totalReaderCount()); + onReaderChanged(MediaSource::NullMediaSource(_tuple), totalReaderCount()); } }); switch (type) {