mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
startSendRtp接口在发送ps时支持只发送音频: #2217
This commit is contained in:
parent
0a1c7cb9c9
commit
384c8677ea
@ -246,6 +246,10 @@ void RtpSender::onConnect(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RtpSender::addTrack(const Track::Ptr &track){
|
bool RtpSender::addTrack(const Track::Ptr &track){
|
||||||
|
if (_args.only_audio && track->getTrackType() == TrackVideo) {
|
||||||
|
// 如果只发送音频则忽略视频
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return _interface->addTrack(track);
|
return _interface->addTrack(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +269,10 @@ void RtpSender::flush() {
|
|||||||
|
|
||||||
//此函数在其他线程执行
|
//此函数在其他线程执行
|
||||||
bool RtpSender::inputFrame(const Frame::Ptr &frame) {
|
bool RtpSender::inputFrame(const Frame::Ptr &frame) {
|
||||||
|
if (_args.only_audio && frame->getTrackType() == TrackVideo) {
|
||||||
|
// 如果只发送音频则忽略视频
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//连接成功后才做实质操作(节省cpu资源)
|
//连接成功后才做实质操作(节省cpu资源)
|
||||||
return _is_connect ? _interface->inputFrame(frame) : false;
|
return _is_connect ? _interface->inputFrame(frame) : false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user