Commit eb78cda6 authored by Tristan Matthews's avatar Tristan Matthews

* #30347: audiolayer: remove ScopedLock

parent 3991a6e0
......@@ -33,7 +33,6 @@
#include "audiolayer.h"
#include "audio/dcblocker.h"
#include "manager.h"
#include "scoped_lock.h"
AudioLayer::AudioLayer()
: captureGain_(1.0)
......@@ -47,31 +46,25 @@ AudioLayer::AudioLayer()
, converter_(sampleRate_)
, lastNotificationTime_(0)
{
pthread_mutex_init(&mutex_, NULL);
urgentRingBuffer_.createReadPointer(MainBuffer::DEFAULT_ID);
}
AudioLayer::~AudioLayer()
{
pthread_mutex_destroy(&mutex_);
}
void AudioLayer::flushMain()
{
sfl::ScopedLock guard(mutex_);
std::lock_guard<std::mutex> lock(mutex_);
// should pass call id
Manager::instance().getMainBuffer().flushAllBuffers();
}
void AudioLayer::flushUrgent()
{
sfl::ScopedLock guard(mutex_);
std::lock_guard<std::mutex> lock(mutex_);
urgentRingBuffer_.flushAll();
}
void AudioLayer::putUrgent(AudioBuffer& buffer)
{
sfl::ScopedLock guard(mutex_);
std::lock_guard<std::mutex> lock(mutex_);
urgentRingBuffer_.put(buffer);
}
......
......@@ -34,7 +34,7 @@
#ifndef AUDIO_LAYER_H_
#define AUDIO_LAYER_H_
#include <pthread.h>
#include <mutex>
#include <sys/time.h>
#include <vector>
#include "ringbuffer.h"
......@@ -80,7 +80,7 @@ class AudioLayer {
};
AudioLayer();
virtual ~AudioLayer();
virtual ~AudioLayer() = default;
virtual std::vector<std::string> getCaptureDeviceList() const = 0;
virtual std::vector<std::string> getPlaybackDeviceList() const = 0;
......@@ -216,7 +216,7 @@ class AudioLayer {
/**
* Lock for the entire audio layer
*/
pthread_mutex_t mutex_;
std::mutex mutex_;
/**
* Remove audio offset that can be introduced by certain cheap audio device
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment