Merge branch 'ZLMediaKit:master' into master

This commit is contained in:
PioLing 2023-12-18 15:43:59 +08:00 committed by GitHub
commit d252895df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 17 deletions

View File

@ -289,7 +289,7 @@ sslport=0
# rtmp是否直接代理模式
directProxy=1
#h265 rtmp打包采用增强型rtmp标准还是国内拓展标准
enhanced=1
enhanced=0
[rtp]
#音频mtu大小该参数限制rtp最大字节数推荐不要超过1400

View File

@ -944,25 +944,29 @@ void installWebApi() {
//批量断开tcp连接比如说可以断开rtsp、rtmp播放器等
//测试url http://127.0.0.1/index/api/kick_sessions?local_port=1935
api_regist("/index/api/kick_sessions",[](API_ARGS_MAP){
api_regist("/index/api/kick_sessions", [](API_ARGS_MAP) {
CHECK_SECRET();
uint16_t local_port = allArgs["local_port"].as<uint16_t>();
string peer_ip = allArgs["peer_ip"];
size_t count_hit = 0;
list<Session::Ptr> session_list;
SessionMap::Instance().for_each_session([&](const string &id,const Session::Ptr &session){
if(local_port != 0 && local_port != session->get_local_port()){
SessionMap::Instance().for_each_session([&](const string &id, const Session::Ptr &session) {
if (local_port != 0 && local_port != session->get_local_port()) {
return;
}
if(!peer_ip.empty() && peer_ip != session->get_peer_ip()){
if (!peer_ip.empty() && peer_ip != session->get_peer_ip()) {
return;
}
if (session->getIdentifier() == sender.getIdentifier()) {
// 忽略本http链接
return;
}
session_list.emplace_back(session);
++count_hit;
});
for(auto &session : session_list){
for (auto &session : session_list) {
session->safeShutdown();
}
val["count_hit"] = (Json::UInt64)count_hit;

View File

@ -673,7 +673,7 @@ FFmpegFrame::Ptr FFmpegSws::inputFrame(const FFmpegFrame::Ptr &frame, int &ret,
auto out = std::make_shared<FFmpegFrame>();
if (!out->get()->data[0]) {
if (data) {
av_image_fill_arrays(out->get()->data, out->get()->linesize, data, _target_format, target_width, target_height, 1);
av_image_fill_arrays(out->get()->data, out->get()->linesize, data, _target_format, target_width, target_height, 32);
} else {
out->fillPicture(_target_format, target_width, target_height);
}

View File

@ -242,7 +242,7 @@ static onceToken token([]() {
mINI::Instance()[kHandshakeSecond] = 15;
mINI::Instance()[kKeepAliveSecond] = 15;
mINI::Instance()[kDirectProxy] = 1;
mINI::Instance()[kEnhanced] = 1;
mINI::Instance()[kEnhanced] = 0;
});
} // namespace Rtmp

View File

@ -104,7 +104,7 @@ bool MP4MuxerInterface::inputFrame(const Frame::Ptr &frame) {
case CodecH264:
case CodecH265: {
// 这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理
track.merger.inputFrame(frame, [&](uint64_t dts, uint64_t pts, const Buffer::Ptr &buffer, bool have_idr) {
track.merger.inputFrame(frame, [this, &track](uint64_t dts, uint64_t pts, const Buffer::Ptr &buffer, bool have_idr) {
int64_t dts_out, pts_out;
track.stamp.revise(dts, pts, dts_out, pts_out);
mp4_writer_write(_mov_writter.get(), track.track_id, buffer->data(), buffer->size(), pts_out, dts_out, have_idr ? MOV_AV_FLAG_KEYFREAME : 0);

View File

@ -55,7 +55,7 @@ bool MpegMuxer::inputFrame(const Frame::Ptr &frame) {
case CodecH264:
case CodecH265: {
// 这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理
return track.merger.inputFrame(frame, [&](uint64_t dts, uint64_t pts, const Buffer::Ptr &buffer, bool have_idr) {
return track.merger.inputFrame(frame, [this, &track](uint64_t dts, uint64_t pts, const Buffer::Ptr &buffer, bool have_idr) {
_key_pos = have_idr;
// 取视频时间戳为TS的时间戳
_timestamp = dts;

View File

@ -111,7 +111,7 @@ void DecoderImp::onDecode(int stream, int codecid, int flags, int64_t pts, int64
onTrack(stream, Factory::getTrackByCodecId(codec, 8000, 1, 16));
}
if (!ref.first) {
WarnL << "not support codec :" << getCodecName(codec);
WarnL << "Unsupported codec :" << getCodecName(codec);
return;
}
auto frame = Factory::getFrameFromPtr(codec, (char *)data, bytes, dts, pts);
@ -119,7 +119,7 @@ void DecoderImp::onDecode(int stream, int codecid, int flags, int64_t pts, int64
onFrame(stream, frame);
return;
}
ref.second.inputFrame(frame, [&](uint64_t dts, uint64_t pts, const Buffer::Ptr &buffer, bool) {
ref.second.inputFrame(frame, [this, stream, codec](uint64_t dts, uint64_t pts, const Buffer::Ptr &buffer, bool) {
onFrame(stream, Factory::getFrameFromBuffer(codec, buffer, dts, pts));
});
}

View File

@ -46,11 +46,7 @@ RtpSession::RtpSession(const Socket::Ptr &sock)
}
}
RtpSession::~RtpSession() {
if (_process) {
RtpSelector::Instance().delProcess(_stream_id, _process.get());
}
}
RtpSession::~RtpSession() = default;
void RtpSession::onRecv(const Buffer::Ptr &data) {
if (_is_udp) {
@ -62,6 +58,9 @@ void RtpSession::onRecv(const Buffer::Ptr &data) {
void RtpSession::onError(const SockException &err) {
WarnP(this) << _stream_id << " " << err;
if (_process) {
RtpSelector::Instance().delProcess(_stream_id, _process.get());
}
}
void RtpSession::onManager() {