fix direct_proxy is 0 repush not success

This commit is contained in:
xiongguangjie 2023-03-25 20:40:40 +08:00
parent 6383e25826
commit 5792af3dd5
3 changed files with 28 additions and 1 deletions

View File

@ -142,6 +142,10 @@ void MultiMediaSourceMuxer::setTrackListener(const std::weak_ptr<Listener> &list
_track_listener = listener;
}
std::weak_ptr<MultiMediaSourceMuxer::Listener> MultiMediaSourceMuxer::getTrackListener(){
return _track_listener;
}
int MultiMediaSourceMuxer::totalReaderCount() const {
auto hls = _hls;
auto ret = (_rtsp ? _rtsp->readerCount() : 0) +

View File

@ -51,6 +51,11 @@ public:
*/
void setTrackListener(const std::weak_ptr<Listener> &listener);
/**
* Track就绪事件监听器
*/
std::weak_ptr<Listener> getTrackListener();
/**
*
*/

View File

@ -301,8 +301,26 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) {
});
return;
}
}else{
auto listener = rtsp_src->getListener(true);
//TraceL<<toolkit::demangle(typeid(*listener.lock()).name());
auto muxer = dynamic_pointer_cast<MultiMediaSourceMuxer>(listener.lock());
if(muxer){
//TraceL;
rtsp_src_imp = dynamic_pointer_cast<RtspMediaSourceImp>(muxer->getTrackListener().lock());
if(rtsp_src_imp){
//TraceL;
_push_src_ownership = rtsp_src_imp->getOwnership();
if(_push_src_ownership){
_push_src = std::move(rtsp_src_imp);
onResPushSrc(option);
return;
}else{
WarnL<<"not reach this";
}
}
}
}
sendRtspResponse("406 Not Acceptable", { "Content-Type", "text/plain" }, "not reach this");
string err = StrPrinter << "ANNOUNCE: not reach this:" << _media_info.shortUrl() << endl;
throw SockException(Err_shutdown, err);