Compare commits

..

No commits in common. "a9fe5d6f4252825bab0f2cfda920ebf58ad0701a" and "986a63bb7324a374217456b5a240e04cf42cf5f3" have entirely different histories.

8 changed files with 5 additions and 42 deletions

View File

@ -342,8 +342,6 @@ rtp_g711_dur_ms = 100
#udp接收数据socket buffer大小配置
#4*1024*1024=4196304
udp_recv_socket_buffer=4194304
#ps/ts解析后是否等待下一帧以判断本帧是否完整开启后提高兼容性但是可能增加延时
merge_frame=1
[rtc]
#rtc播放推流、播放超时时间

View File

@ -426,7 +426,7 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &sender, const MediaSourceE
}
});
rtp_sender->startSend(sender, args, [ssrc,ssrc_multi_send, weak_self, rtp_sender, cb, tracks, ring, poller](uint16_t local_port, const SockException &ex) mutable {
rtp_sender->startSend(args, [ssrc,ssrc_multi_send, weak_self, rtp_sender, cb, tracks, ring, poller](uint16_t local_port, const SockException &ex) mutable {
cb(local_port, ex);
auto strong_self = weak_self.lock();
if (!strong_self || ex) {

View File

@ -366,7 +366,6 @@ const string kOpusPT = RTP_PROXY_FIELD "opus_pt";
const string kGopCache = RTP_PROXY_FIELD "gop_cache";
const string kRtpG711DurMs = RTP_PROXY_FIELD "rtp_g711_dur_ms";
const string kUdpRecvSocketBuffer = RTP_PROXY_FIELD "udp_recv_socket_buffer";
const std::string kMergeFrame = RTP_PROXY_FIELD "merge_frame";
static onceToken token([]() {
mINI::Instance()[kDumpDir] = "";
@ -379,7 +378,6 @@ static onceToken token([]() {
mINI::Instance()[kGopCache] = 1;
mINI::Instance()[kRtpG711DurMs] = 100;
mINI::Instance()[kUdpRecvSocketBuffer] = 4 * 1024 * 1024;
mINI::Instance()[kMergeFrame] = 1;
});
} // namespace RtpProxy

View File

@ -563,8 +563,6 @@ extern const std::string kGopCache;
extern const std::string kRtpG711DurMs;
// udp recv socket buffer size
extern const std::string kUdpRecvSocketBuffer;
// ps/ts解析后是否等待下一帧以判断本帧是否完整开启后提高兼容性但是可能增加延时
extern const std::string kMergeFrame;
} // namespace RtpProxy
/**

View File

@ -11,7 +11,6 @@
#include "Decoder.h"
#include "PSDecoder.h"
#include "TSDecoder.h"
#include "Common/config.h"
#include "Extension/Factory.h"
#if defined(ENABLE_RTPPROXY) || defined(ENABLE_HLS)
@ -123,18 +122,11 @@ void DecoderImp::onDecode(int stream, int codecid, int flags, int64_t pts, int64
WarnL << "Unsupported codec :" << getCodecName(codec);
return;
}
GET_CONFIG(bool, merge_frame, RtpProxy::kMergeFrame)
auto frame = Factory::getFrameFromPtr(codec, (char *)data, bytes, dts, pts);
if (getTrackType(codec) != TrackVideo || !merge_frame) {
if (getTrackType(codec) != TrackVideo) {
onFrame(stream, frame);
if (_last_is_keyframe && _video_merge) {
// 上次是关键帧,收到音频后,说明帧收齐了
_video_merge->flush();
}
return;
}
_last_is_keyframe = frame->keyFrame() || frame->configFrame();
_video_merge = &ref.second;
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

@ -59,14 +59,13 @@ private:
private:
bool _finished = false;
bool _have_video = false;
bool _last_is_keyframe = false;
Decoder::Ptr _decoder;
MediaSinkInterface *_sink;
class FrameMergerImp : public FrameMerger {
public:
FrameMergerImp() : FrameMerger(FrameMerger::none) {}
};
FrameMergerImp *_video_merge = nullptr;
std::unordered_map<int, std::pair<Track::Ptr, FrameMergerImp> > _tracks;
};

View File

@ -35,16 +35,7 @@ RtpSender::~RtpSender() {
}
}
void RtpSender::startSend(const MediaSource &sender, const MediaSourceEvent::SendRtpArgs &args, const function<void(uint16_t local_port, const SockException &ex)> &cb){
auto origin_socket = sender.getOriginSock();
_origin_socket = dynamic_pointer_cast<Socket>(origin_socket);
if (!_origin_socket) {
auto process = dynamic_pointer_cast<RtpProcess>(origin_socket);
if (process) {
_origin_socket = process->getSock();
}
}
void RtpSender::startSend(const MediaSourceEvent::SendRtpArgs &args, const function<void(uint16_t local_port, const SockException &ex)> &cb){
_args = args;
if (!_interface) {
// 重连时不重新创建对象 [AUTO-TRANSLATED:b788cd5d]
@ -322,15 +313,6 @@ void RtpSender::onConnect() {
}
});
}
if (_socket_rtp->sockType() == toolkit::SockNum::Sock_TCP && _origin_socket) {
// rtp 端口是TCP端口转发速度应当控制收流速度
auto origin_socket = _origin_socket;
_socket_rtp->setOnFlush([origin_socket]() {
origin_socket->enableRecv(true);
return true;
});
}
InfoL << "startSend rtp success: " << _socket_rtp->get_peer_ip() << ":" << _socket_rtp->get_peer_port() << ", data_type: " << _args.data_type << ", con_type: " << _args.con_type;
}
@ -451,9 +433,6 @@ void RtpSender::onFlushRtpList(shared_ptr<List<Buffer::Ptr>> rtp_list) {
}
default: CHECK(0);
}
if (_socket_rtp->sockType() == toolkit::SockNum::Sock_TCP && _socket_rtp->isSocketBusy() && _origin_socket) {
_origin_socket->enableRecv(false);
}
});
};
if (_args.con_type != MediaSourceEvent::SendRtpArgs::kVoiceTalk) {

View File

@ -40,7 +40,7 @@ public:
* [AUTO-TRANSLATED:c31bd9b3]
*/
void startSend(const MediaSource &sender, const MediaSourceEvent::SendRtpArgs &args, const std::function<void(uint16_t local_port, const toolkit::SockException &ex)> &cb);
void startSend(const MediaSourceEvent::SendRtpArgs &args, const std::function<void(uint16_t local_port, const toolkit::SockException &ex)> &cb);
/**
*
@ -116,7 +116,6 @@ private:
private:
bool _is_connect = false;
toolkit::Socket::Ptr _origin_socket;
MediaSourceEvent::SendRtpArgs _args;
toolkit::Socket::Ptr _socket_rtp;
toolkit::Socket::Ptr _socket_rtcp;