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
a38ea129
Commit
a38ea129
authored
May 27, 2010
by
Alexandre Savard
Browse files
[#3443] Add change sampling rate notification in managerimpl
parent
d80e9a30
Changes
4
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/audio/echocancel.cpp
View file @
a38ea129
...
...
@@ -144,7 +144,6 @@ EchoCancel::~EchoCancel()
void
EchoCancel
::
reset
()
{
_debug
(
"EchoCancel: Reset internal state, Sampling rate %d, Frame size %d"
,
_samplingRate
,
_smplPerFrame
);
_debug
(
"SIZEOF INT %d"
,
sizeof
(
int
));
memset
(
_avgSpkrLevelHist
,
0
,
BUFF_SIZE
*
sizeof
(
int
));
memset
(
_avgMicLevelHist
,
0
,
BUFF_SIZE
*
sizeof
(
int
));
...
...
@@ -250,12 +249,11 @@ int EchoCancel::process(SFLDataFormat *inputData, SFLDataFormat *outputData, int
int
spkrAvail
=
_spkrData
->
AvailForGet
();
int
micAvail
=
_micData
->
AvailForGet
();
_debug
(
"EchoCancel: speaker avail %d, mic avail %d, processed: %d"
,
spkrAvail
/
320
,
micAvail
/
320
,
_processedByte
/
320
);
//
_debug("EchoCancel: speaker avail %d, mic avail %d, processed: %d", spkrAvail/320, micAvail/320, _processedByte/320);
// Init number of frame processed
int
nbFrame
=
0
;
// Get data from mic and speaker internal buffer
while
((
spkrAvail
>=
byteSize
)
&&
(
micAvail
>=
byteSize
))
{
...
...
sflphone-common/src/audio/mainbuffer.cpp
View file @
a38ea129
...
...
@@ -31,6 +31,7 @@
#include
"mainbuffer.h"
#include
"manager.h"
MainBuffer
::
MainBuffer
()
:
_internalSamplingRate
(
8000
)
{
...
...
@@ -55,6 +56,8 @@ void MainBuffer::setInternalSamplingRate (int sr)
flushAllBuffers
();
Manager
::
instance
().
audioSamplingRateChanged
();
}
}
...
...
sflphone-common/src/managerimpl.cpp
View file @
a38ea129
...
...
@@ -2895,6 +2895,83 @@ void ManagerImpl::switchAudioManager (void) {
// }
}
void
ManagerImpl
::
audioSamplingRateChanged
(
void
)
{
int
type
,
samplerate
,
framesize
,
numCardIn
,
numCardOut
,
numCardRing
;
std
::
string
alsaPlugin
;
_debug
(
"Manager: Audio Sampling Rate"
);
if
(
!
_audiodriver
)
return
;
type
=
_audiodriver
->
getLayerType
();
samplerate
=
_mainBuffer
.
getInternalSamplingRate
();
framesize
=
getConfigInt
(
AUDIO
,
ALSA_FRAME_SIZE
);
_debug
(
"Mnager: samplerate: %i, framesize %i
\n
"
,
samplerate
,
framesize
);
alsaPlugin
=
getConfigString
(
AUDIO
,
ALSA_PLUGIN
);
numCardIn
=
getConfigInt
(
AUDIO
,
ALSA_CARD_ID_IN
);
numCardOut
=
getConfigInt
(
AUDIO
,
ALSA_CARD_ID_OUT
);
numCardRing
=
getConfigInt
(
AUDIO
,
ALSA_CARD_ID_RING
);
_debug
(
"Manager: Deleting current layer... "
);
// ost::MutexLock lock (*getAudioLayerMutex());
getAudioLayerMutex
()
->
enter
();
// _audiodriver->closeLayer();
delete
_audiodriver
;
_audiodriver
=
NULL
;
switch
(
type
)
{
case
PULSEAUDIO
:
_debug
(
"Manager: Creating Pulseaudio layer..."
);
_audiodriver
=
new
PulseLayer
(
this
);
_audiodriver
->
setMainBuffer
(
&
_mainBuffer
);
break
;
case
ALSA
:
_debug
(
"Manager: Creating ALSA layer..."
);
_audiodriver
=
new
AlsaLayer
(
this
);
_audiodriver
->
setMainBuffer
(
&
_mainBuffer
);
break
;
default:
_warn
(
"Manager: Error: audio layer unknown"
);
break
;
}
_audiodriver
->
setErrorMessage
(
-
1
);
_audiodriver
->
openDevice
(
numCardIn
,
numCardOut
,
numCardRing
,
samplerate
,
framesize
,
SFL_PCM_BOTH
,
alsaPlugin
);
if
(
_audiodriver
->
getErrorMessage
()
!=
-
1
)
notifyErrClient
(
_audiodriver
->
getErrorMessage
());
_debug
(
"Manager: Current device: %i "
,
type
);
_debug
(
"Manager: Has current call: %i "
,
hasCurrentCall
());
if
(
hasCurrentCall
())
_audiodriver
->
startStream
();
// ost::MutexLock unlock (*getAudioLayerMutex());
getAudioLayerMutex
()
->
leave
();
// need to stop audio streams if there is currently no call
// if ( (type != PULSEAUDIO) && (!hasCurrentCall())) {
// _debug("There is currently a call!!");
// _audiodriver->stopStream();
// }
}
/**
* Init the volume for speakers/micro from 0 to 100 value
* Initialization: Main Thread
...
...
sflphone-common/src/managerimpl.h
View file @
a38ea129
...
...
@@ -788,6 +788,8 @@ class ManagerImpl {
void
switchAudioManager
(
void
);
void
audioSamplingRateChanged
(
void
);
/**
* Get the desktop mail notification level
* @return int The mail notification level
...
...
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