mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Fix the ASLSA capture problem one more time
This commit is contained in:
@ -135,20 +135,45 @@ 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 )
|
||||
|
Reference in New Issue
Block a user