mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-20 00:37:49 +08:00
rtp推流时打印ssrc
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
This commit is contained in:
parent
dd1e8ef430
commit
444aeceacc
@ -107,6 +107,7 @@ bool RtpProcess::inputRtp(bool is_udp, const Socket::Ptr &sock, const char *data
|
|||||||
if (!_auth_err.empty()) {
|
if (!_auth_err.empty()) {
|
||||||
throw toolkit::SockException(toolkit::Err_other, _auth_err);
|
throw toolkit::SockException(toolkit::Err_other, _auth_err);
|
||||||
}
|
}
|
||||||
|
auto header = (RtpHeader *) data;
|
||||||
if (_sock != sock) {
|
if (_sock != sock) {
|
||||||
// 第一次运行本函数 [AUTO-TRANSLATED:a1d7ac17]
|
// 第一次运行本函数 [AUTO-TRANSLATED:a1d7ac17]
|
||||||
// First time running this function
|
// First time running this function
|
||||||
@ -114,7 +115,7 @@ bool RtpProcess::inputRtp(bool is_udp, const Socket::Ptr &sock, const char *data
|
|||||||
_sock = sock;
|
_sock = sock;
|
||||||
_addr.reset(new sockaddr_storage(*((sockaddr_storage *)addr)));
|
_addr.reset(new sockaddr_storage(*((sockaddr_storage *)addr)));
|
||||||
if (first) {
|
if (first) {
|
||||||
emitOnPublish();
|
emitOnPublish(ntohl(header->ssrc));
|
||||||
_cache_ticker.resetTime();
|
_cache_ticker.resetTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +132,6 @@ bool RtpProcess::inputRtp(bool is_udp, const Socket::Ptr &sock, const char *data
|
|||||||
_process = std::make_shared<GB28181Process>(_media_info, this);
|
_process = std::make_shared<GB28181Process>(_media_info, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto header = (RtpHeader *) data;
|
|
||||||
onRtp(ntohs(header->seq), ntohl(header->stamp), 0/*不发送sr,所以可以设置为0*/ , 90000/*ps/ts流时间戳按照90K采样率*/, len);
|
onRtp(ntohs(header->seq), ntohl(header->stamp), 0/*不发送sr,所以可以设置为0*/ , 90000/*ps/ts流时间戳按照90K采样率*/, len);
|
||||||
|
|
||||||
GET_CONFIG(string, dump_dir, RtpProxy::kDumpDir);
|
GET_CONFIG(string, dump_dir, RtpProxy::kDumpDir);
|
||||||
@ -271,15 +271,15 @@ string RtpProcess::getIdentifier() const {
|
|||||||
return _media_info.stream;
|
return _media_info.stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtpProcess::emitOnPublish() {
|
void RtpProcess::emitOnPublish(uint32_t ssrc) {
|
||||||
weak_ptr<RtpProcess> weak_self = shared_from_this();
|
weak_ptr<RtpProcess> weak_self = shared_from_this();
|
||||||
Broadcast::PublishAuthInvoker invoker = [weak_self](const string &err, const ProtocolOption &option) {
|
Broadcast::PublishAuthInvoker invoker = [weak_self, ssrc](const string &err, const ProtocolOption &option) {
|
||||||
auto strong_self = weak_self.lock();
|
auto strong_self = weak_self.lock();
|
||||||
if (!strong_self) {
|
if (!strong_self) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto poller = strong_self->getOwnerPoller(MediaSource::NullMediaSource());
|
auto poller = strong_self->getOwnerPoller(MediaSource::NullMediaSource());
|
||||||
poller->async([weak_self, err, option]() {
|
poller->async([weak_self, err, option, ssrc]() {
|
||||||
auto strong_self = weak_self.lock();
|
auto strong_self = weak_self.lock();
|
||||||
if (!strong_self) {
|
if (!strong_self) {
|
||||||
return;
|
return;
|
||||||
@ -293,7 +293,7 @@ void RtpProcess::emitOnPublish() {
|
|||||||
}
|
}
|
||||||
strong_self->_muxer->setMediaListener(strong_self);
|
strong_self->_muxer->setMediaListener(strong_self);
|
||||||
strong_self->doCachedFunc();
|
strong_self->doCachedFunc();
|
||||||
InfoP(strong_self) << "允许RTP推流";
|
InfoP(strong_self) << "允许RTP推流,ssrc: " << printSSRC(ssrc);
|
||||||
} else {
|
} else {
|
||||||
strong_self->_auth_err = err;
|
strong_self->_auth_err = err;
|
||||||
WarnP(strong_self) << "禁止RTP推流:" << err;
|
WarnP(strong_self) << "禁止RTP推流:" << err;
|
||||||
|
|||||||
@ -122,7 +122,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
RtpProcess(const MediaTuple &tuple);
|
RtpProcess(const MediaTuple &tuple);
|
||||||
|
|
||||||
void emitOnPublish();
|
void emitOnPublish(uint32_t ssrc);
|
||||||
void doCachedFunc();
|
void doCachedFunc();
|
||||||
bool alive();
|
bool alive();
|
||||||
void onManager();
|
void onManager();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user