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

Ticket #101 fixed

parent 6745c09a
No related branches found
No related tags found
No related merge requests found
......@@ -195,10 +195,6 @@ AlsaLayer::putUrgent(void* buffer, int toCopy)
int
AlsaLayer::canGetMic()
{
_debug("alsa\n");
int avail;
if ( _CaptureHandle ) {
avail = snd_pcm_avail_update( _CaptureHandle );
......
......@@ -28,7 +28,7 @@ AudioStream::AudioStream( pa_context* context, int type, std::string desc, doubl
sample_spec.rate = 44100;
sample_spec.channels = 1;
channel_map.channels = 1;
pa_cvolume_set( &_volume , 1 , PA_VOLUME_MUTED ) ; // * vol / 100 ;
pa_cvolume_set( &_volume , 1 , PA_VOLUME_NORM ) ; // * vol / 100 ;
_audiostream = createStream( context );
}
......
......@@ -199,7 +199,6 @@ PulseLayer::putUrgent(void* buffer, int toCopy)
int
PulseLayer::canGetMic()
{
_debug("pulseaudio");
if( record )
return _micRingBuffer.AvailForGet();
else
......
......@@ -252,14 +252,18 @@ IAXVoIPLink::sendAudioFromMic(void)
// Send sound here
if (audiolayer) {
_debug("hum");
// we have to get 20ms of data from the mic *20/1000 = /50
// rate/50 shall be lower than IAX__20S_48KHZ_MAX
maxBytesToGet = audiolayer->getSampleRate()* audiolayer->getFrameSize() / 1000 * sizeof(SFLDataFormat);
// We have to update the audio layer type in case we switched
// TODO Find out a better way to do it
updateAudiolayer();
// available bytes inside ringbuffer
availBytesFromMic = audiolayer->canGetMic();
if (availBytesFromMic < maxBytesToGet) {
// We need packets full!
return;
......@@ -887,3 +891,8 @@ IAXVoIPLink::iaxCodecMapToFormat(IAXCall* call)
}
void IAXVoIPLink::updateAudiolayer( void )
{
audiolayer = NULL;
audiolayer = Manager::instance().getAudioDriver();
}
......@@ -188,6 +188,8 @@ class IAXVoIPLink : public VoIPLink
*/
void setPass(const std::string& pass) { _pass = pass; }
void updateAudiolayer( void );
private:
/**
* Get IAX Call from an id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment