[*] 添加判断
This commit is contained in:
@@ -306,6 +306,10 @@ namespace acgist {
|
|||||||
webrtc::PeerConnectionFactoryInterface* factory,
|
webrtc::PeerConnectionFactoryInterface* factory,
|
||||||
webrtc::PeerConnectionInterface::RTCConfiguration& rtcConfiguration
|
webrtc::PeerConnectionInterface::RTCConfiguration& rtcConfiguration
|
||||||
) {
|
) {
|
||||||
|
if(this->device->IsLoaded()) {
|
||||||
|
LOG_W("配置已经加载");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->factory = factory;
|
this->factory = factory;
|
||||||
this->rtcConfiguration = new webrtc::PeerConnectionInterface::RTCConfiguration(rtcConfiguration);
|
this->rtcConfiguration = new webrtc::PeerConnectionInterface::RTCConfiguration(rtcConfiguration);
|
||||||
mediasoupclient::PeerConnection::Options options;
|
mediasoupclient::PeerConnection::Options options;
|
||||||
@@ -360,9 +364,14 @@ namespace acgist {
|
|||||||
{ "opusStereo", true },
|
{ "opusStereo", true },
|
||||||
{ "opusDtx", true }
|
{ "opusDtx", true }
|
||||||
};
|
};
|
||||||
|
rtc::scoped_refptr<webrtc::AudioTrackInterface> track = mediaStream->GetAudioTracks()[0];
|
||||||
|
if(track->state() == webrtc::MediaStreamTrackInterface::TrackState::kEnded) {
|
||||||
|
LOG_W("音频媒体状态错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->audioProducer = this->sendTransport->Produce(
|
this->audioProducer = this->sendTransport->Produce(
|
||||||
this->producerListener,
|
this->producerListener,
|
||||||
mediaStream->GetAudioTracks()[0],
|
track,
|
||||||
nullptr,
|
nullptr,
|
||||||
&codecOptions,
|
&codecOptions,
|
||||||
nullptr
|
nullptr
|
||||||
@@ -399,9 +408,14 @@ namespace acgist {
|
|||||||
// encodings.emplace_back(max);
|
// encodings.emplace_back(max);
|
||||||
// 强制设置编码器
|
// 强制设置编码器
|
||||||
// nlohmann::json codec = this->device->GetRtpCapabilities()["codec"];
|
// nlohmann::json codec = this->device->GetRtpCapabilities()["codec"];
|
||||||
|
rtc::scoped_refptr<webrtc::VideoTrackInterface> track = mediaStream->GetVideoTracks()[0];
|
||||||
|
if(track->state() == webrtc::MediaStreamTrackInterface::TrackState::kEnded) {
|
||||||
|
LOG_W("视频媒体状态错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->videoProducer = this->sendTransport->Produce(
|
this->videoProducer = this->sendTransport->Produce(
|
||||||
this->producerListener,
|
this->producerListener,
|
||||||
mediaStream->GetVideoTracks()[0],
|
track,
|
||||||
nullptr,
|
nullptr,
|
||||||
&codecOptions,
|
&codecOptions,
|
||||||
nullptr
|
nullptr
|
||||||
|
|||||||
Reference in New Issue
Block a user