Skip to content

Commit

Permalink
适配utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyfcu committed Apr 22, 2024
1 parent fb8aa35 commit d627f81
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/source/mk_media.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MediaHelper: public MediaSourceEvent, public std::enable_shared_from_this<
bool close(MediaSource &sender) override {
if (!_on_close) {
//未设置回调,没法关闭
WarnL << "请使用mk_media_set_on_close函数设置回调函数!";
WarnL << u8"请使用mk_media_set_on_close函数设置回调函数!";
return false;
}
//请在回调中调用mk_media_release函数释放资源,否则MediaSource::close()操作不会生效
Expand Down
2 changes: 0 additions & 2 deletions server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ class CMD_main : public CMD {
string g_ini_file;

int start_main(int argc,char *argv[]) {
Factory::loadPlugins();

{
CMD_main cmd_main;
try {
Expand Down
6 changes: 3 additions & 3 deletions src/Common/MediaSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ static void findAsync_l(const MediaInfo &info, const std::shared_ptr<Session> &s
cancel_all();
if (auto strong_session = weak_session.lock()) {
//播发器请求的流终于注册上了,切换到自己的线程再回复
DebugL << "收到媒体注册事件,回复播放器:" << info.getUrl();
DebugL << u8"收到媒体注册事件,回复播放器:" << info.getUrl();
//再找一遍媒体源,一般能找到
findAsync_l(info, strong_session, false, cb_once);
}
Expand Down Expand Up @@ -514,7 +514,7 @@ void MediaSource::emitEvent(bool regist){
}
//触发广播
NOTICE_EMIT(BroadcastMediaChangedArgs, Broadcast::kBroadcastMediaChanged, regist, *this);
InfoL << (regist ? "媒体注册:" : "媒体注销:") << getUrl();
InfoL << (regist ? u8"媒体注册:" : u8"媒体注销:") << getUrl();
}

void MediaSource::regist() {
Expand Down Expand Up @@ -687,7 +687,7 @@ void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){
}
} else {
//这个是mp4点播,我们自动关闭
WarnL << "MP4点播无人观看,自动关闭:" << strong_sender->getUrl();
WarnL << u8"MP4点播无人观看,自动关闭:" << strong_sender->getUrl();
strong_sender->close(false);
}
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/Extension/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ extern CodecPlugin g711a_plugin;
extern CodecPlugin g711u_plugin;
extern CodecPlugin l16_plugin;

onceToken g_plugins_token([]() { Factory::loadPlugins(); });

void Factory::loadPlugins() {
registerPlugin(h264_plugin);
registerPlugin(h265_plugin);
Expand Down
6 changes: 2 additions & 4 deletions src/Rtsp/RtspSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ RtspSession::RtspSession(const Socket::Ptr &sock) : Session(sock) {
void RtspSession::onError(const SockException &err) {
bool is_player = !_push_src_ownership;
uint64_t duration = _alive_ticker.createdTime() / 1000;
WarnP(this) << (is_player ? "RTSP播放器(" : "RTSP推流器(")
<< _media_info.shortUrl()
<< ")断开:" << err.what()
<< ",耗时(s):" << duration;
WarnP(this) << (is_player ? u8"RTSP播放器(" : u8"RTSP推流器(")
<< _media_info.shortUrl() << u8")断开:" << err.what() << u8",耗时(s):" << duration;

if (_rtp_type == Rtsp::RTP_MULTICAST) {
//取消UDP端口监听
Expand Down

0 comments on commit d627f81

Please sign in to comment.