修复拉流代理获取流信息可能访问空指针的bug

此bug由 #2448 引入,触发条件:
- 1.配置文件rtsp.directProxy设置为0
- 2.调用addStreamProxy代理rtsp流

在非直接代理情况下,PlayerProxy::_media_src为空,导致访问空指针。
This commit is contained in:
xia-chu 2023-05-13 00:02:06 +08:00
parent f6ac39ade5
commit 0afe75229e

View File

@ -65,8 +65,8 @@ void PlayerProxy::setOnConnect(std::function<void(const TranslationInfo&)> cb) {
void PlayerProxy::setTranslationInfo()
{
_transtalion_info.byte_speed = _media_src->getBytesSpeed();
_transtalion_info.start_time_stamp = _media_src->getCreateStamp();
_transtalion_info.byte_speed = _media_src ? _media_src->getBytesSpeed() : -1;
_transtalion_info.start_time_stamp = _media_src ? _media_src->getCreateStamp() : 0;
_transtalion_info.stream_info.clear();
auto tracks = _muxer->getTracks();
for (auto &track : tracks) {