Skip to content
Snippets Groups Projects
Commit 180c0cf9 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#1966] Moved audioProcessing from mainbuffer to audiolayer

parent e7dd0a3c
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include <cc++/thread.h> // for ost::Mutex #include <cc++/thread.h> // for ost::Mutex
#include "echocancel.h"
#include "algorithm.h"
#define FRAME_PER_BUFFER 160 #define FRAME_PER_BUFFER 160
/** /**
...@@ -295,6 +299,10 @@ class AudioLayer { ...@@ -295,6 +299,10 @@ class AudioLayer {
*/ */
ost::Mutex _mutex; ost::Mutex _mutex;
EchoCancel *_echoCancel;
AudioProcessing *_audioProcessing;
}; };
#endif // _AUDIO_LAYER_H_ #endif // _AUDIO_LAYER_H_
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
MainBuffer::MainBuffer() : _internalSamplingRate (0) MainBuffer::MainBuffer() : _internalSamplingRate (0)
{ {
mixBuffer = new SFLDataFormat[STATIC_BUFSIZE]; mixBuffer = new SFLDataFormat[STATIC_BUFSIZE];
_echoCancel = new EchoCancel();
_audioProcessing = new AudioProcessing(static_cast<Algorithm *>(_echoCancel));
} }
...@@ -36,9 +33,6 @@ MainBuffer::~MainBuffer() ...@@ -36,9 +33,6 @@ MainBuffer::~MainBuffer()
{ {
delete [] mixBuffer; mixBuffer = NULL; delete [] mixBuffer; mixBuffer = NULL;
delete _echoCancel; _echoCancel = NULL;
delete _audioProcessing; _audioProcessing = NULL;
} }
...@@ -360,15 +354,11 @@ int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, Ca ...@@ -360,15 +354,11 @@ int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, Ca
RingBuffer* ring_buffer = getRingBuffer (call_id); RingBuffer* ring_buffer = getRingBuffer (call_id);
if (ring_buffer == NULL) { if (!ring_buffer) {
return 0; return 0;
} }
return ring_buffer->Get (buffer, toCopy, volume, reader_id); return ring_buffer->Get (buffer, toCopy, volume, reader_id);
return 0;
} }
...@@ -383,7 +373,7 @@ int MainBuffer::availForGet (CallID call_id) ...@@ -383,7 +373,7 @@ int MainBuffer::availForGet (CallID call_id)
return 0; return 0;
if (callid_set->empty()) { if (callid_set->empty()) {
_debug ("CallIDSet with ID: \"%s\" is empty!", call_id.c_str()); _debug ("MainBuffer: CallIDSet with ID: \"%s\" is empty!", call_id.c_str());
return 0; return 0;
} }
...@@ -419,15 +409,13 @@ int MainBuffer::availForGetByID (CallID call_id, CallID reader_id) ...@@ -419,15 +409,13 @@ int MainBuffer::availForGetByID (CallID call_id, CallID reader_id)
{ {
if ( (call_id != default_id) && (reader_id == call_id)) { if ( (call_id != default_id) && (reader_id == call_id)) {
_error("MainBuffer: Error: RingBuffer has a readpointer on tiself");
_debug ("**********************************************************************");
_debug ("Error an RTP session ring buffer is not supposed to have a readpointer on tiself");
} }
RingBuffer* ringbuffer = getRingBuffer (call_id); RingBuffer* ringbuffer = getRingBuffer (call_id);
if (ringbuffer == NULL) { if (ringbuffer == NULL) {
_debug ("Error: ring buffer does not exist"); _error("MainBuffer: Error: RingBuffer does not exist");
return 0; return 0;
} else } else
return ringbuffer->AvailForGet (reader_id); return ringbuffer->AvailForGet (reader_id);
...@@ -548,7 +536,7 @@ void MainBuffer::flushAllBuffers() ...@@ -548,7 +536,7 @@ void MainBuffer::flushAllBuffers()
void MainBuffer::stateInfo() void MainBuffer::stateInfo()
{ {
_debug ("MainBuffer state info"); _debug ("MainBuffer: State info");
CallIDMap::iterator iter_call = _callIDMap.begin(); CallIDMap::iterator iter_call = _callIDMap.begin();
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#include "../global.h" #include "../global.h"
#include "../call.h" #include "../call.h"
#include "ringbuffer.h" #include "ringbuffer.h"
#include "echocancel.h"
#include "algorithm.h"
...@@ -112,10 +110,6 @@ public: ...@@ -112,10 +110,6 @@ public:
int _internalSamplingRate; int _internalSamplingRate;
EchoCancel *_echoCancel;
AudioProcessing *_audioProcessing;
public: public:
friend class MainBufferTest; friend class MainBufferTest;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment