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

Fix the ASLSA capture problem one more time

parent 73df747e
Branches
Tags
No related merge requests found
......@@ -134,21 +134,46 @@ AlsaLayer::stopStream(void)
int
AlsaLayer::canGetMic()
{
{
int avail;
if (!_CaptureHandle)
return 0;
avail = snd_pcm_avail_update (_CaptureHandle);
if (avail == -EPIPE)
{
stop_capture ();
return 0;
}
else
return ((avail<0)?0:avail);
/*
if(_CaptureHandle)
return _micRingBuffer.AvailForGet();
else
return 0;
return 0;*/
}
int
AlsaLayer::getMic(void *buffer, int toCopy)
{
/*
if( _CaptureHandle ){
return _micRingBuffer.Get(buffer, toCopy,100);
}
else
return 0;
return 0;*/
int res = 0;
if( _CaptureHandle )
{
res = read( buffer, toCopy);
adjustVolume (buffer, toCopy, SFL_PCM_CAPTURE);
}
return res;
}
bool AlsaLayer::isCaptureActive(void) {
......@@ -669,7 +694,7 @@ void AlsaLayer::audioCallback (void)
// Additionally handle the mic's audio stream
//if(is_capture_running()){
micAvailAlsa = snd_pcm_avail_update(_CaptureHandle);
/*micAvailAlsa = snd_pcm_avail_update(_CaptureHandle);
if(micAvailAlsa > 0) {
micAvailPut = _micRingBuffer.AvailForPut();
toPut = (micAvailAlsa <= micAvailPut) ? micAvailAlsa : micAvailPut;
......@@ -680,7 +705,7 @@ void AlsaLayer::audioCallback (void)
_micRingBuffer.Put(in, toPut, 100);
}
free(in); in=0;
}
}*/
}
void* AlsaLayer::adjustVolume( void* buffer , int len, int stream )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment