sndio: No need to use a timer so get rid of it

This commit is contained in:
Dimitris Papastamos 2016-06-22 10:27:47 +01:00 committed by Max Kellermann
parent 1207fd1f16
commit d68cadba7b

View File

@ -27,7 +27,6 @@
#include "config/ConfigError.hxx" #include "config/ConfigError.hxx"
#include "../OutputAPI.hxx" #include "../OutputAPI.hxx"
#include "../Wrapper.hxx" #include "../Wrapper.hxx"
#include "../Timer.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -42,7 +41,6 @@ class SndioOutput {
AudioOutput base; AudioOutput base;
const char *device; const char *device;
struct sio_hdl *sio_hdl; struct sio_hdl *sio_hdl;
Timer *timer;
public: public:
SndioOutput() SndioOutput()
@ -160,7 +158,6 @@ SndioOutput::Open(AudioFormat &audio_format, gcc_unused Error &error)
goto err; goto err;
} }
timer = new Timer(audio_format);
return true; return true;
err: err:
sio_close(sio_hdl); sio_close(sio_hdl);
@ -171,15 +168,6 @@ void
SndioOutput::Close() SndioOutput::Close()
{ {
sio_close(sio_hdl); sio_close(sio_hdl);
delete timer;
}
unsigned
SndioOutput::Delay() const
{
return timer->IsStarted()
? timer->GetDelay()
: 0;
} }
size_t size_t
@ -187,10 +175,6 @@ SndioOutput::Play(const void *chunk, size_t size, Error &error)
{ {
ssize_t n; ssize_t n;
if (!timer->IsStarted())
timer->Start();
timer->Add(size);
while (1) { while (1) {
n = sio_write(sio_hdl, chunk, size); n = sio_write(sio_hdl, chunk, size);
if (n < 0) { if (n < 0) {
@ -203,12 +187,6 @@ SndioOutput::Play(const void *chunk, size_t size, Error &error)
} }
} }
void
SndioOutput::Cancel()
{
timer->Reset();
}
typedef AudioOutputWrapper<SndioOutput> Wrapper; typedef AudioOutputWrapper<SndioOutput> Wrapper;
const struct AudioOutputPlugin sndio_output_plugin = { const struct AudioOutputPlugin sndio_output_plugin = {
@ -220,11 +198,11 @@ const struct AudioOutputPlugin sndio_output_plugin = {
nullptr, nullptr,
&Wrapper::Open, &Wrapper::Open,
&Wrapper::Close, &Wrapper::Close,
&Wrapper::Delay, nullptr,
nullptr, nullptr,
&Wrapper::Play, &Wrapper::Play,
nullptr, nullptr,
&Wrapper::Cancel, nullptr,
nullptr, nullptr,
nullptr, nullptr,
}; };