Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
6ab63073
Commit
6ab63073
authored
Sep 09, 2009
by
Alexandre Savard
Browse files
[#2006] Fix G722 and Speex 8khz codec conferencing
Instanciate AudioCodec for each rtp session
parent
31356d9b
Changes
6
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/audio/audiortp.cpp
View file @
6ab63073
...
...
@@ -318,7 +318,8 @@ AudioRtpRTX::setRtpSessionMedia (void)
return
;
}
_audiocodec
=
_ca
->
getLocalSDP
()
->
get_session_media
();
AudioCodecType
pl
=
(
AudioCodecType
)
_ca
->
getLocalSDP
()
->
get_session_media
()
->
getPayload
();
_audiocodec
=
Manager
::
instance
().
getCodecDescriptorMap
().
instantiateCodec
(
pl
);
if
(
_audiocodec
==
NULL
)
{
_debug
(
" !ARTP: No audiocodec, can't init RTP media
\n
"
);
...
...
@@ -327,9 +328,7 @@ AudioRtpRTX::setRtpSessionMedia (void)
_debug
(
"Init audio RTP session: codec payload %i
\n
"
,
_audiocodec
->
getPayload
());
if
(
_audiocodec
==
NULL
)
{
return
;
}
// _audioCodecInstance = *_audiocodec;
_codecSampleRate
=
_audiocodec
->
getClockRate
();
...
...
sflphone-common/src/audio/audiortp.h
View file @
6ab63073
...
...
@@ -31,6 +31,7 @@
#include
"../global.h"
// #include "plug-in/audiorecorder/audiorecord.h"
#include
"../samplerateconverter.h"
#include
"codecDescriptor.h"
#include
<fstream>
...
...
@@ -223,7 +224,8 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
int
reSampleData
(
SFLDataFormat
*
input
,
SFLDataFormat
*
output
,
int
sampleRate_codec
,
int
nbSamples
,
int
status
);
/** The audio codec used during the session */
AudioCodec
*
_audiocodec
;
AudioCodec
*
_audiocodec
;
// AudioCodec _audioCodecInstance;
/** Mutex */
ost
::
Mutex
_rtpRtxMutex
;
...
...
@@ -234,6 +236,7 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
std
::
fstream
*
rtp_output_rec
;
static
int
count_rtp
;
};
...
...
sflphone-common/src/audio/codecDescriptor.cpp
View file @
6ab63073
...
...
@@ -3,6 +3,7 @@
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -125,7 +126,7 @@ CodecDescriptor::addCodec (AudioCodecType payload UNUSED)
double
CodecDescriptor
::
getBitRate
(
AudioCodecType
payload
)
{
CodecsMap
::
iterator
iter
=
_CodecsMap
.
find
(
payload
);
CodecsMap
::
iterator
iter
=
_CodecsMap
.
find
(
payload
);
if
(
iter
!=
_CodecsMap
.
end
())
return
(
iter
->
second
->
getBitRate
());
...
...
@@ -250,13 +251,14 @@ CodecDescriptor::loadCodec (std::string path)
AudioCodec
*
a
=
createCodec
();
p
=
CodecHandlePointer
(
a
,
codecHandle
);
p
=
CodecHandlePointer
(
a
,
codecHandle
);
_CodecInMemory
.
push_back
(
p
);
_CodecInMemory
.
push_back
(
p
);
return
a
;
}
void
CodecDescriptor
::
unloadCodec
(
CodecHandlePointer
p
)
{
...
...
@@ -272,6 +274,34 @@ CodecDescriptor::unloadCodec (CodecHandlePointer p)
dlclose
(
p
.
second
);
}
AudioCodec
*
CodecDescriptor
::
instantiateCodec
(
AudioCodecType
payload
)
{
using
std
::
cerr
;
std
::
vector
<
CodecHandlePointer
>::
iterator
iter
=
_CodecInMemory
.
begin
();
while
(
iter
!=
_CodecInMemory
.
end
())
{
if
(
iter
->
first
->
getPayload
()
==
payload
)
{
create_t
*
createCodec
=
(
create_t
*
)
dlsym
(
iter
->
second
,
"create"
);
if
(
dlerror
())
cerr
<<
dlerror
()
<<
'\n'
;
AudioCodec
*
a
=
createCodec
();
return
a
;
}
iter
++
;
}
return
NULL
;
}
AudioCodec
*
CodecDescriptor
::
getFirstCodecAvailable
(
void
)
{
...
...
sflphone-common/src/audio/codecDescriptor.h
View file @
6ab63073
...
...
@@ -72,6 +72,7 @@ typedef std::map<AudioCodecType , AudioCodec*> CodecsMap;
*/
class
CodecDescriptor
{
public:
/**
* Constructor
...
...
@@ -117,7 +118,7 @@ class CodecDescriptor {
/**
* Set the default codecs order
*/
*/
void
setDefaultOrder
();
/**
...
...
@@ -195,6 +196,12 @@ class CodecDescriptor {
*/
AudioCodec
*
getFirstCodecAvailable
(
void
);
/**
* Instantiate a codec, used in AudioRTP to get an instance of Codec per call
* @param CodecHandlePointer The map containing the pointer on the object and the pointer on the handle function
*/
AudioCodec
*
instantiateCodec
(
AudioCodecType
payload
);
private:
/**
...
...
@@ -217,6 +224,7 @@ class CodecDescriptor {
*/
void
unloadCodec
(
CodecHandlePointer
);
/**
* Check if the files found in searched directories seems valid
* @param std::string The name of the file
...
...
sflphone-common/src/call.h
View file @
6ab63073
...
...
@@ -269,8 +269,10 @@ class Call{
/** Type of the call */
CallType
_type
;
/** Disconnected/Progressing/Trying/Ringing/Connected */
ConnectionState
_connectionState
;
/** Inactive/Active/Hold/Busy/Refused/Error */
CallState
_callState
;
...
...
sflphone-common/src/sdp.cpp
View file @
6ab63073
...
...
@@ -144,6 +144,7 @@ int Sdp::create_local_offer ()
sdp_add_session_name
();
sdp_add_connection_info
();
sdp_add_timing
();
//sdp_addAttributes( _pool );
sdp_add_media_description
();
...
...
@@ -174,7 +175,7 @@ int Sdp::create_initial_offer()
// Create the SDP negociator instance with local offer
status
=
pjmedia_sdp_neg_create_w_local_offer
(
_pool
,
get_local_sdp_session
(),
&
_negociator
);
state
=
pjmedia_sdp_neg_get_state
(
_negociator
);
state
=
pjmedia_sdp_neg_get_state
(
_negociator
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment