mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
audio: remove unused dcblocker
Change-Id: I1c4b30bee4cac1767b53353799ac819faf95a9cb
This commit is contained in:

committed by
Adrien Béraud

parent
d3fe2b9849
commit
a9ebdd6db1
@ -21,8 +21,6 @@ list (APPEND Source_Files__media__audio
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/audiolayer.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/audioloop.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/audioloop.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/dcblocker.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/dcblocker.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resampler.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resampler.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ringbuffer.cpp"
|
||||
|
@ -15,7 +15,6 @@ libaudio_la_SOURCES = $(RING_SPEEXDSP_SRC) \
|
||||
./media/audio/ringbufferpool.cpp \
|
||||
./media/audio/audiolayer.cpp \
|
||||
./media/audio/resampler.cpp \
|
||||
./media/audio/dcblocker.cpp \
|
||||
./media/audio/audio_sender.cpp \
|
||||
./media/audio/audio_receive_thread.cpp \
|
||||
./media/audio/audio_rtp_session.cpp \
|
||||
@ -45,7 +44,6 @@ noinst_HEADERS += $(RING_SPEEXDSP_HEAD) \
|
||||
./media/audio/ringbufferpool.h \
|
||||
./media/audio/audiolayer.h \
|
||||
./media/audio/resampler.h \
|
||||
./media/audio/dcblocker.h \
|
||||
./media/audio/audio_sender.h \
|
||||
./media/audio/audio_receive_thread.h \
|
||||
./media/audio/audio_rtp_session.h \
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "audiolayer.h"
|
||||
#include "audio/dcblocker.h"
|
||||
#include "logger.h"
|
||||
#include "manager.h"
|
||||
#include "audio/ringbufferpool.h"
|
||||
|
@ -23,7 +23,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "ringbuffer.h"
|
||||
#include "dcblocker.h"
|
||||
#include "noncopyable.h"
|
||||
#include "audio_frame_resizer.h"
|
||||
#include "audio-processing/audio_processor.h"
|
||||
@ -290,11 +289,6 @@ protected:
|
||||
*/
|
||||
mutable std::mutex mutex_ {};
|
||||
|
||||
/**
|
||||
* Remove audio offset that can be introduced by certain cheap audio device
|
||||
*/
|
||||
DcBlocker dcblocker_ {};
|
||||
|
||||
/**
|
||||
* Manage sampling rate conversion
|
||||
*/
|
||||
|
@ -332,7 +332,6 @@ CoreLayer::startStream(AudioDeviceType stream)
|
||||
}
|
||||
status_ = Status::Started;
|
||||
|
||||
dcblocker_.reset();
|
||||
if (!initAudioLayerIO(stream) || AudioUnitInitialize(ioUnit_) || AudioOutputUnitStart(ioUnit_)) {
|
||||
destroyAudioLayer();
|
||||
status_ = Status::Idle;
|
||||
|
@ -335,8 +335,6 @@ CoreLayer::startStream(AudioDeviceType stream)
|
||||
return;
|
||||
status_ = Status::Started;
|
||||
|
||||
dcblocker_.reset();
|
||||
|
||||
initAudioLayerIO(stream);
|
||||
|
||||
auto inputError = AudioUnitInitialize(ioUnit_);
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2023 Savoir-faire Linux Inc.
|
||||
*
|
||||
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "dcblocker.h"
|
||||
|
||||
#include <ciso646> // fix windows compiler bug
|
||||
|
||||
namespace jami {
|
||||
|
||||
DcBlocker::DcBlocker(unsigned channels /* = 1 */)
|
||||
: states(channels, StreamState {0, 0, 0, 0})
|
||||
{}
|
||||
|
||||
void
|
||||
DcBlocker::reset()
|
||||
{
|
||||
states.assign(states.size(), StreamState {0, 0, 0, 0});
|
||||
}
|
||||
|
||||
void
|
||||
DcBlocker::doProcess(AudioSample* out, AudioSample* in, unsigned samples, struct StreamState* state)
|
||||
{
|
||||
for (unsigned i = 0; i < samples; ++i) {
|
||||
state->x_ = in[i];
|
||||
|
||||
state->y_ = (AudioSample)((float) state->x_ - (float) state->xm1_
|
||||
+ 0.9999 * (float) state->y_);
|
||||
state->xm1_ = state->x_;
|
||||
state->ym1_ = state->y_;
|
||||
|
||||
out[i] = state->y_;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DcBlocker::process(AudioSample* out, AudioSample* in, int samples)
|
||||
{
|
||||
if (out == NULL or in == NULL or samples == 0)
|
||||
return;
|
||||
doProcess(out, in, samples, &states[0]);
|
||||
}
|
||||
|
||||
void
|
||||
DcBlocker::process(AudioBuffer& buf)
|
||||
{
|
||||
const size_t chans = buf.channels();
|
||||
const size_t samples = buf.frames();
|
||||
if (chans > states.size())
|
||||
states.resize(buf.channels(), StreamState {0, 0, 0, 0});
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < chans; i++) {
|
||||
AudioSample* chan = buf.getChannel(i)->data();
|
||||
doProcess(chan, chan, samples, &states[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace jami
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2023 Savoir-faire Linux Inc.
|
||||
*
|
||||
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
|
||||
* Author: Adrien Beraud <adrien.beraud@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef DCBLOCKER_H
|
||||
#define DCBLOCKER_H
|
||||
|
||||
#include "ring_types.h"
|
||||
#include "audiobuffer.h"
|
||||
|
||||
namespace jami {
|
||||
|
||||
class DcBlocker
|
||||
{
|
||||
public:
|
||||
DcBlocker(unsigned channels = 1);
|
||||
void reset();
|
||||
|
||||
void process(AudioSample* out, AudioSample* in, int samples);
|
||||
|
||||
/**
|
||||
* In-place processing of all samples in buf (each channel treated independently)
|
||||
*/
|
||||
void process(AudioBuffer& buf);
|
||||
|
||||
private:
|
||||
struct StreamState
|
||||
{
|
||||
AudioSample y_, x_, xm1_, ym1_;
|
||||
};
|
||||
|
||||
void doProcess(AudioSample* out, AudioSample* in, unsigned samples, struct StreamState* state);
|
||||
|
||||
std::vector<StreamState> states;
|
||||
};
|
||||
|
||||
} // namespace jami
|
||||
|
||||
#endif
|
@ -383,7 +383,6 @@ void JackLayer::startStream(AudioDeviceType)
|
||||
return;
|
||||
status_ = Status::Started;
|
||||
|
||||
dcblocker_.reset();
|
||||
if (jack_activate(playbackClient_) or jack_activate(captureClient_)) {
|
||||
JAMI_ERR("Could not activate JACK client");
|
||||
return;
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "audio/ringbufferpool.h"
|
||||
#include "audio/ringbuffer.h"
|
||||
#include "audio/dcblocker.h"
|
||||
#include "libav_utils.h"
|
||||
#include "manager.h"
|
||||
#include "logger.h"
|
||||
|
@ -681,8 +681,6 @@ PortAudioLayer::PortAudioLayerImpl::initFullDuplexStream(PortAudioLayer& parent)
|
||||
return false;
|
||||
}
|
||||
|
||||
parent.dcblocker_.reset();
|
||||
|
||||
JAMI_DBG("Open PortAudio Full-duplex input/output stream");
|
||||
auto& stream = streams_[Direction::IO];
|
||||
openFullDuplexStream(
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "compiler_intrinsics.h"
|
||||
#include "audiostream.h"
|
||||
#include "pulselayer.h"
|
||||
#include "audio/dcblocker.h"
|
||||
#include "audio/ringbufferpool.h"
|
||||
#include "audio/ringbuffer.h"
|
||||
#include "libav_utils.h"
|
||||
|
@ -73,7 +73,6 @@ libjami_sources = files(
|
||||
'media/audio/audiobuffer.cpp',
|
||||
'media/audio/audiolayer.cpp',
|
||||
'media/audio/audioloop.cpp',
|
||||
'media/audio/dcblocker.cpp',
|
||||
'media/audio/dsp.cpp',
|
||||
'media/audio/resampler.cpp',
|
||||
'media/audio/ringbuffer.cpp',
|
||||
|
Reference in New Issue
Block a user