Skip to content
Snippets Groups Projects
Commit 0fc7dfab authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Protect the use of session_media

parent bce5af68
No related branches found
No related tags found
No related merge requests found
...@@ -190,6 +190,9 @@ AudioRtpRTX::initAudioRtpSession (void) ...@@ -190,6 +190,9 @@ AudioRtpRTX::initAudioRtpSession (void)
try { try {
if (_ca == 0) { return; } if (_ca == 0) { return; }
_audiocodec = _ca->getLocalSDP()->get_session_media (); _audiocodec = _ca->getLocalSDP()->get_session_media ();
if (_audiocodec == NULL) { return; }
_codecSampleRate = _audiocodec->getClockRate(); _codecSampleRate = _audiocodec->getClockRate();
ost::InetHostAddress remote_ip(_ca->getLocalSDP()->get_remote_ip().c_str()); ost::InetHostAddress remote_ip(_ca->getLocalSDP()->get_remote_ip().c_str());
......
...@@ -303,12 +303,18 @@ AudioCodec* Sdp::get_session_media( void ){ ...@@ -303,12 +303,18 @@ AudioCodec* Sdp::get_session_media( void ){
int nb_media; int nb_media;
int nb_codec; int nb_codec;
AudioCodec *codec = NULL;
nb_media = _session_media.size(); nb_media = _session_media.size();
if (nb_media > 0) {
nb_codec = _session_media[0]->get_media_codec_list().size(); nb_codec = _session_media[0]->get_media_codec_list().size();
if (nb_codec > 0) {
return _session_media[0]->get_media_codec_list()[0]; codec = _session_media[0]->get_media_codec_list()[0];
}
} }
return codec;
}
void Sdp::toString (void) { void Sdp::toString (void) {
......
...@@ -846,11 +846,17 @@ SIPVoIPLink::isRecording(const CallID& id) ...@@ -846,11 +846,17 @@ SIPVoIPLink::isRecording(const CallID& id)
SIPVoIPLink::getCurrentCodecName() SIPVoIPLink::getCurrentCodecName()
{ {
SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId()); SIPCall *call;
AudioCodec *ac;
std::string name = "";
call = getSIPCall(Manager::instance().getCurrentCallId());
ac = call->getLocalSDP()->get_session_media();
AudioCodec *ac = call->getLocalSDP()->get_session_media(); if (ac)
name = ac->getCodecName();
return ac->getCodecName(); return name;
} }
bool bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment