Compare commits

..

No commits in common. "3aa9b8977cd7caac5933d16777fcff24edb9744a" and "c440c45ce4603c58960acb71867093f546629e5d" have entirely different histories.

10 changed files with 7 additions and 46 deletions

View File

@ -289,7 +289,7 @@ void H265RtpEncoder::packRtpFu(const char *ptr, size_t len, uint64_t pts, bool i
// Pass in nullptr first, do not copy the payload memory
// 只有FU的最后一个分片且整个帧需要设置mark时才设置mark位
bool mark_bit = fu_end && is_mark;
auto rtp = getRtpInfo().makeRtp(TrackVideo, nullptr, max_size + 3, mark_bit, pts);
auto rtp = getRtpInfo().makeRtp(TrackVideo, nullptr, max_size + 3, mark_bit && is_mark, pts); //yzw 帧(不是NALU多TILE时一帧有多个NALU)最后一个rtp才设置mark位
// rtp payload 负载部分 [AUTO-TRANSLATED:03a5ef9b]
// rtp payload load part
uint8_t *payload = rtp->getPayload();

View File

@ -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<MediaSource> s_null = std::make_shared<MediaSourceNull>();
MediaSource &MediaSource::NullMediaSource(const MediaTuple &tuple) {
static std::shared_ptr<MediaSource> s_null = std::make_shared<MediaSourceNull>(tuple);
return *s_null;
}

View File

@ -397,7 +397,8 @@ bool equalMediaTuple(const MediaTuple& a, const MediaTuple& b);
*/
class MediaSource: public TrackSource, public std::enable_shared_from_this<MediaSource> {
public:
static MediaSource& NullMediaSource();
static MediaSource &NullMediaSource(const MediaTuple &tuple = {"vhost", "app", "stream" });
using Ptr = std::shared_ptr<MediaSource>;
MediaSource(const std::string &schema, const MediaTuple& tuple);

View File

@ -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(*getAnyMediaSource(), totalReaderCount());
onReaderChanged(MediaSource::NullMediaSource(_tuple), totalReaderCount());
}
});
switch (type) {
@ -908,24 +908,6 @@ bool MultiMediaSourceMuxer::onTrackFrame_l(const Frame::Ptr &frame_in) {
return ret;
}
#define TRY_SRC(muxer) \
if (muxer) { \
auto src = muxer->getMediaSource(); \
if (src) { \
return src; \
} \
}
MediaSource::Ptr MultiMediaSourceMuxer::getAnyMediaSource() const {
TRY_SRC(_fmp4)
TRY_SRC(_rtmp)
TRY_SRC(_rtsp)
TRY_SRC(_ts)
TRY_SRC(_hls)
TRY_SRC(_hls_fmp4)
return MediaSource::NullMediaSource().shared_from_this();
}
bool MultiMediaSourceMuxer::isEnabled(){
GET_CONFIG(uint32_t, stream_none_reader_delay_ms, General::kStreamNoneReaderDelayMS);
if (!_is_enable || _last_check.elapsedTime() > stream_none_reader_delay_ms) {

View File

@ -237,8 +237,6 @@ protected:
bool onTrackFrame(const Frame::Ptr &frame) override;
bool onTrackFrame_l(const Frame::Ptr &frame);
MediaSource::Ptr getAnyMediaSource() const;
private:
void createGopCacheIfNeed(size_t gop_count);
std::shared_ptr<MediaSinkInterface> makeRecorder(Recorder::type type);

View File

@ -73,10 +73,6 @@ public:
_media_src->setInitSegment(getInitSegment());
}
MediaSource::Ptr getMediaSource() const {
return _media_src;
}
protected:
void onSegmentData(std::string string, uint64_t stamp, bool key_frame) override {
if (string.empty()) {

View File

@ -77,10 +77,6 @@ public:
return _option.hls_demand ? (_clear_cache ? true : _enabled) : true;
}
MediaSource::Ptr getMediaSource() const {
return _hls ? _hls->getMediaSource() : nullptr;
}
protected:
bool _enabled = true;
bool _clear_cache = false;

View File

@ -81,10 +81,6 @@ public:
return _option.rtmp_demand ? (_clear_cache ? true : _enabled) : true;
}
MediaSource::Ptr getMediaSource() const {
return _media_src;
}
private:
bool _enabled = true;
bool _clear_cache = false;

View File

@ -80,10 +80,6 @@ public:
return _option.rtsp_demand ? (_clear_cache ? true : _enabled) : true;
}
MediaSource::Ptr getMediaSource() const {
return _media_src;
}
private:
bool _enabled = true;
bool _clear_cache = false;

View File

@ -68,10 +68,6 @@ public:
return _option.ts_demand ? (_clear_cache ? true : _enabled) : true;
}
MediaSource::Ptr getMediaSource() const {
return _media_src;
}
protected:
void onWrite(std::shared_ptr<toolkit::Buffer> buffer, uint64_t timestamp, bool key_pos) override {
if (!buffer) {