修正代码拼写错误

This commit is contained in:
monktan89 2022-11-30 18:24:35 +08:00
parent 68ea5465cc
commit a12b7c8021
6 changed files with 22 additions and 22 deletions

View File

@ -18,8 +18,8 @@ namespace mediakit {
WebRtcPlayer::Ptr WebRtcPlayer::create(const EventPoller::Ptr &poller,
const RtspMediaSource::Ptr &src,
const MediaInfo &info,
bool perferred_tcp) {
WebRtcPlayer::Ptr ret(new WebRtcPlayer(poller, src, info, perferred_tcp), [](WebRtcPlayer *ptr) {
bool preferred_tcp) {
WebRtcPlayer::Ptr ret(new WebRtcPlayer(poller, src, info, preferred_tcp), [](WebRtcPlayer *ptr) {
ptr->onDestory();
delete ptr;
});
@ -30,7 +30,7 @@ WebRtcPlayer::Ptr WebRtcPlayer::create(const EventPoller::Ptr &poller,
WebRtcPlayer::WebRtcPlayer(const EventPoller::Ptr &poller,
const RtspMediaSource::Ptr &src,
const MediaInfo &info,
bool perferred_tcp) : WebRtcTransportImp(poller,perferred_tcp) {
bool preferred_tcp) : WebRtcTransportImp(poller,preferred_tcp) {
_media_info = info;
_play_src = src;
CHECK(_play_src);

View File

@ -20,7 +20,7 @@ class WebRtcPlayer : public WebRtcTransportImp {
public:
using Ptr = std::shared_ptr<WebRtcPlayer>;
~WebRtcPlayer() override = default;
static Ptr create(const EventPoller::Ptr &poller, const RtspMediaSource::Ptr &src, const MediaInfo &info, bool perferred_tcp = false);
static Ptr create(const EventPoller::Ptr &poller, const RtspMediaSource::Ptr &src, const MediaInfo &info, bool preferred_tcp = false);
protected:
///////WebRtcTransportImp override///////
@ -30,7 +30,7 @@ protected:
void onRecvRtp(MediaTrack &track, const std::string &rid, RtpPacket::Ptr rtp) override {};
private:
WebRtcPlayer(const EventPoller::Ptr &poller, const RtspMediaSource::Ptr &src, const MediaInfo &info, bool perferred_tcp);
WebRtcPlayer(const EventPoller::Ptr &poller, const RtspMediaSource::Ptr &src, const MediaInfo &info, bool preferred_tcp);
private:
//媒体相关元数据

View File

@ -20,8 +20,8 @@ WebRtcPusher::Ptr WebRtcPusher::create(const EventPoller::Ptr &poller,
const std::shared_ptr<void> &ownership,
const MediaInfo &info,
const ProtocolOption &option,
bool perferred_tcp) {
WebRtcPusher::Ptr ret(new WebRtcPusher(poller, src, ownership, info, option,perferred_tcp), [](WebRtcPusher *ptr) {
bool preferred_tcp) {
WebRtcPusher::Ptr ret(new WebRtcPusher(poller, src, ownership, info, option,preferred_tcp), [](WebRtcPusher *ptr) {
ptr->onDestory();
delete ptr;
});
@ -34,7 +34,7 @@ WebRtcPusher::WebRtcPusher(const EventPoller::Ptr &poller,
const std::shared_ptr<void> &ownership,
const MediaInfo &info,
const ProtocolOption &option,
bool perferred_tcp) : WebRtcTransportImp(poller,perferred_tcp) {
bool preferred_tcp) : WebRtcTransportImp(poller,preferred_tcp) {
_media_info = info;
_push_src = src;
_push_src_ownership = ownership;

View File

@ -21,7 +21,7 @@ public:
using Ptr = std::shared_ptr<WebRtcPusher>;
~WebRtcPusher() override = default;
static Ptr create(const EventPoller::Ptr &poller, const RtspMediaSourceImp::Ptr &src,
const std::shared_ptr<void> &ownership, const MediaInfo &info, const ProtocolOption &option, bool perferred_tcp = false);
const std::shared_ptr<void> &ownership, const MediaInfo &info, const ProtocolOption &option, bool preferred_tcp = false);
protected:
///////WebRtcTransportImp override///////
@ -52,7 +52,7 @@ protected:
private:
WebRtcPusher(const EventPoller::Ptr &poller, const RtspMediaSourceImp::Ptr &src,
const std::shared_ptr<void> &ownership, const MediaInfo &info, const ProtocolOption &option, bool perferred_tcp);
const std::shared_ptr<void> &ownership, const MediaInfo &info, const ProtocolOption &option, bool preferred_tcp);
private:
bool _simulcast = false;

View File

@ -403,8 +403,8 @@ void WebRtcTransportImp::OnDtlsTransportApplicationDataReceived(const RTC::DtlsT
#endif
}
WebRtcTransportImp::WebRtcTransportImp(const EventPoller::Ptr &poller,bool perferred_tcp)
: WebRtcTransport(poller), _perferred_tcp(perferred_tcp) {
WebRtcTransportImp::WebRtcTransportImp(const EventPoller::Ptr &poller,bool preferred_tcp)
: WebRtcTransport(poller), _preferred_tcp(preferred_tcp) {
InfoL << getIdentifier();
}
@ -630,13 +630,13 @@ void WebRtcTransportImp::onRtcConfigure(RtcConfigure &configure) const {
if (extern_ips.empty()) {
std::string local_ip = SockUtil::get_local_ip();
if (local_udp_port) { configure.addCandidate(*makeIceCandidate(local_ip, local_udp_port, 120, "udp")); }
if (local_tcp_port) { configure.addCandidate(*makeIceCandidate(local_ip, local_tcp_port, _perferred_tcp ? 125 : 115, "tcp")); }
if (local_tcp_port) { configure.addCandidate(*makeIceCandidate(local_ip, local_tcp_port, _preferred_tcp ? 125 : 115, "tcp")); }
} else {
const uint32_t delta = 10;
uint32_t priority = 100 + delta * extern_ips.size();
for (auto ip : extern_ips) {
if (local_udp_port) { configure.addCandidate(*makeIceCandidate(ip, local_udp_port, priority, "udp")); }
if (local_tcp_port) { configure.addCandidate(*makeIceCandidate(ip, local_tcp_port, priority - (_perferred_tcp ? -5 : 5), "tcp")); }
if (local_tcp_port) { configure.addCandidate(*makeIceCandidate(ip, local_tcp_port, priority - (_preferred_tcp ? -5 : 5), "tcp")); }
priority -= delta;
}
}
@ -1154,9 +1154,9 @@ void echo_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginMana
void push_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginManager::onCreateRtc &cb) {
MediaInfo info(args["url"]);
bool perferred_tcp = args["perferred_tcp"];
bool preferred_tcp = args["preferred_tcp"];
Broadcast::PublishAuthInvoker invoker = [cb, info, perferred_tcp](const string &err, const ProtocolOption &option) mutable {
Broadcast::PublishAuthInvoker invoker = [cb, info, preferred_tcp](const string &err, const ProtocolOption &option) mutable {
if (!err.empty()) {
cb(WebRtcException(SockException(Err_other, err)));
return;
@ -1195,7 +1195,7 @@ void push_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginMana
push_src_ownership = push_src->getOwnership();
push_src->setProtocolOption(option);
}
auto rtc = WebRtcPusher::create(EventPollerPool::Instance().getPoller(), push_src, push_src_ownership, info, option, perferred_tcp);
auto rtc = WebRtcPusher::create(EventPollerPool::Instance().getPoller(), push_src, push_src_ownership, info, option, preferred_tcp);
push_src->setListener(rtc);
cb(*rtc);
};
@ -1210,10 +1210,10 @@ void push_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginMana
void play_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginManager::onCreateRtc &cb) {
MediaInfo info(args["url"]);
bool perferred_tcp = args["perferred_tcp"];
bool preferred_tcp = args["preferred_tcp"];
auto session_ptr = sender.shared_from_this();
Broadcast::AuthInvoker invoker = [cb, info, session_ptr, perferred_tcp](const string &err) mutable {
Broadcast::AuthInvoker invoker = [cb, info, session_ptr, preferred_tcp](const string &err) mutable {
if (!err.empty()) {
cb(WebRtcException(SockException(Err_other, err)));
return;
@ -1229,7 +1229,7 @@ void play_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginMana
}
// 还原成rtc目的是为了hook时识别哪种播放协议
info._schema = RTC_SCHEMA;
auto rtc = WebRtcPlayer::create(EventPollerPool::Instance().getPoller(), src, info, perferred_tcp);
auto rtc = WebRtcPlayer::create(EventPollerPool::Instance().getPoller(), src, info, preferred_tcp);
cb(*rtc);
});
};

View File

@ -249,7 +249,7 @@ public:
void createRtpChannel(const std::string &rid, uint32_t ssrc, MediaTrack &track);
protected:
WebRtcTransportImp(const EventPoller::Ptr &poller,bool perferred_tcp = false);
WebRtcTransportImp(const EventPoller::Ptr &poller,bool preferred_tcp = false);
void OnDtlsTransportApplicationDataReceived(const RTC::DtlsTransport *dtlsTransport, const uint8_t *data, size_t len) override;
void onStartWebRTC() override;
void onSendSockData(Buffer::Ptr buf, bool flush = true, RTC::TransportTuple *tuple = nullptr) override;
@ -279,7 +279,7 @@ private:
void onCheckAnswer(RtcSession &sdp);
private:
bool _perferred_tcp;
bool _preferred_tcp;
uint16_t _rtx_seq[2] = {0, 0};
//用掉的总流量
uint64_t _bytes_usage = 0;