- fix opus codec usage

This commit is contained in:
2021-06-09 13:06:26 +03:00
parent 61be61b7e3
commit 9479a0f36f
11 changed files with 42 additions and 22 deletions

View File

@@ -26,7 +26,7 @@ AudioProvider::AudioProvider(UserAgent& agent, MT::Terminal& terminal)
if (mUserAgent.config().exists(CONFIG_CODEC_PRIORITY))
mCodecPriority.setupFrom(mUserAgent.config()[CONFIG_CODEC_PRIORITY].asVMap());
mSrtpSuite = SRTP_NONE;
setState((int)StreamState::SipRecv | (int)StreamState::SipSend | (int)StreamState::Receiving | (int)StreamState::Sending);
setStateImpl((int)StreamState::SipRecv | (int)StreamState::SipSend | (int)StreamState::Receiving | (int)StreamState::Sending);
}
AudioProvider::~AudioProvider()
@@ -182,6 +182,7 @@ void AudioProvider::sessionEstablished(int conntype)
{
RemoteCodec& rc = mAvailableCodecs.front();
mActiveStream->setTransmittingCodec(*rc.mFactory, rc.mRemotePayloadType);
auto codec = dynamic_cast<MT::AudioStream*>(mActiveStream.get())->transmittingCodec();
dynamic_cast<MT::AudioStream*>(mActiveStream.get())->setTelephoneCodec(mRemoteTelephoneCodec);
}
}
@@ -271,11 +272,10 @@ bool AudioProvider::processSdpOffer(const resip::SdpContents::Session::Medium& m
return true;
}
void AudioProvider::setState(unsigned state)
{
mState = state;
if (mActiveStream)
mActiveStream->setState(state);
setStateImpl(state);
}
unsigned AudioProvider::state()
@@ -381,3 +381,10 @@ void AudioProvider::setupMirror(bool enable)
if (mActiveStream)
mActiveStream->setupMirror(enable);
}
void AudioProvider::setStateImpl(unsigned int state) {
mState = state;
if (mActiveStream)
mActiveStream->setState(state);
}

View File

@@ -64,8 +64,9 @@ public:
// Returns true if description is processed succesfully. Otherwise method returns false.
// myAnswer sets if the answer will be sent after.
bool processSdpOffer(const resip::SdpContents::Session::Medium& media, SdpDirection sdpDirection);
void setState(unsigned state);
void setState(unsigned state) override;
unsigned state();
MT::Statistics getStatistics();
MT::PStream activeStream();
@@ -112,6 +113,10 @@ protected:
std::string createCryptoAttribute(SrtpSuite suite);
SrtpSuite processCryptoAttribute(const resip::Data& value, ByteBuffer& key);
void findRfc2833(const resip::SdpContents::Session::Medium::CodecContainer& codecs);
// Implements setState() logic. This allows to be called from constructor (it is not virtual function)
void setStateImpl(unsigned state);
};
#endif

View File

@@ -726,7 +726,7 @@ void Session::buildSdp(resip::SdpContents &sdp, SdpDirection sdpDirection)
if (mUserAgent->mConfig[CONFIG_MULTIPLEXING].asBool())
media.addAttribute("rtcp-mux");
// Ask provider about specific information
// Ask provider about specific information - codecs are filled here
provider.updateSdpOffer(media, sdpDirection);
// Add ICE information