Skip to content
Snippets Groups Projects
Commit d333b18a authored by Adrien Béraud's avatar Adrien Béraud
Browse files

opensl: honor isCaptureMuted

Change-Id: I06b2265fbcbc6ecad641da38a06e692bef10208b
parent 8e524d37
No related branches found
No related tags found
No related merge requests found
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#include "client/ring_signal.h" #include "client/ring_signal.h"
#include "audio/resampler.h"
#include "audio/ringbufferpool.h" #include "audio/ringbufferpool.h"
#include "audio/ringbuffer.h" #include "audio/ringbuffer.h"
#include "audio/dcblocker.h" #include "audio/dcblocker.h"
#include "libav_utils.h"
#include "manager.h" #include "manager.h"
#include "logger.h" #include "logger.h"
#include "array_size.h" #include "array_size.h"
...@@ -350,8 +350,12 @@ OpenSLLayer::startAudioCapture() ...@@ -350,8 +350,12 @@ OpenSLLayer::startAudioCapture()
if (buf->size_ > 0) { if (buf->size_ > 0) {
auto nb_samples = buf->size_ / hardwareFormat_.getBytesPerFrame(); auto nb_samples = buf->size_ / hardwareFormat_.getBytesPerFrame();
auto out = std::make_unique<AudioFrame>(hardwareFormat_, nb_samples); auto out = std::make_unique<AudioFrame>(hardwareFormat_, nb_samples);
if (isCaptureMuted_)
libav_utils::fillWithSilence(out->pointer());
else
std::copy_n((const AudioSample*)buf->buf_, nb_samples, (AudioSample*)out->pointer()->data[0]); std::copy_n((const AudioSample*)buf->buf_, nb_samples, (AudioSample*)out->pointer()->data[0]);
audioCaptureFillBuffer(std::move(out)); // dcblocker_.process(buffer);
mainRingBuffer_->put(std::move(out));
} }
buf->size_ = 0; buf->size_ = 0;
freeRecBufQueue_.push(buf); freeRecBufQueue_.push(buf);
...@@ -476,15 +480,6 @@ void ...@@ -476,15 +480,6 @@ void
OpenSLLayer::updatePreference(AudioPreference& /*preference*/, int /*index*/, DeviceType /*type*/) OpenSLLayer::updatePreference(AudioPreference& /*preference*/, int /*index*/, DeviceType /*type*/)
{} {}
void OpenSLLayer::audioCaptureFillBuffer(std::unique_ptr<AudioFrame>&& frame)
{
RingBufferPool &mbuffer = Manager::instance().getRingBufferPool();
// buffer.applyGain(isCaptureMuted_ ? 0.0 : captureGain_);
// dcblocker_.process(buffer);
mainRingBuffer_->put(resampler_->resample(std::move(frame), mbuffer.getInternalAudioFormat()));
}
void dumpAvailableEngineInterfaces() void dumpAvailableEngineInterfaces()
{ {
SLresult result; SLresult result;
......
...@@ -118,8 +118,6 @@ class OpenSLLayer : public AudioLayer { ...@@ -118,8 +118,6 @@ class OpenSLLayer : public AudioLayer {
void engineServiceRec(bool waiting); void engineServiceRec(bool waiting);
private: private:
void audioCaptureFillBuffer(std::unique_ptr<AudioFrame>&& buffer);
/** /**
* Get the index of the audio card for capture * Get the index of the audio card for capture
* @return int The index of the card used for capture * @return int The index of the card used for capture
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment