diff options
author | Chris Robinson <[email protected]> | 2018-12-22 11:38:38 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-22 11:38:38 -0800 |
commit | 10ce121dbd05e048c89a2b7c32f2ddabbc8fbe77 (patch) | |
tree | 534a48d8776c2e7cac9ee275f040aeb78198a534 /Alc/backends/oss.cpp | |
parent | b955c5cf5dbdc0814daa349e90907229774574aa (diff) |
Use a normal delete instead of ll_ringbuffer_free
And use RingBufferPtr in more places
Diffstat (limited to 'Alc/backends/oss.cpp')
-rw-r--r-- | Alc/backends/oss.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp index 110672c7..065f159a 100644 --- a/Alc/backends/oss.cpp +++ b/Alc/backends/oss.cpp @@ -501,7 +501,7 @@ void ALCplaybackOSS_stop(ALCplaybackOSS *self) struct ALCcaptureOSS final : public ALCbackend { int fd{-1}; - ll_ringbuffer_t *mRing{nullptr}; + RingBufferPtr mRing{nullptr}; std::atomic<ALenum> mKillNow{AL_TRUE}; std::thread mThread; @@ -537,8 +537,6 @@ void ALCcaptureOSS_Destruct(ALCcaptureOSS *self) close(self->fd); self->fd = -1; - ll_ringbuffer_free(self->mRing); - self->mRing = nullptr; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~ALCcaptureOSS(); } @@ -580,7 +578,7 @@ int ALCcaptureOSS_recordProc(ALCcaptureOSS *self) continue; } - auto vec = ll_ringbuffer_get_write_vector(self->mRing); + auto vec = ll_ringbuffer_get_write_vector(self->mRing.get()); if(vec.first.len > 0) { amt = read(self->fd, vec.first.buf, vec.first.len*frame_size); @@ -592,7 +590,7 @@ int ALCcaptureOSS_recordProc(ALCcaptureOSS *self) ALCcaptureOSS_unlock(self); break; } - ll_ringbuffer_write_advance(self->mRing, amt/frame_size); + ll_ringbuffer_write_advance(self->mRing.get(), amt/frame_size); } } @@ -698,7 +696,8 @@ ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) return ALC_INVALID_VALUE; } - self->mRing = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, false); + self->mRing.reset(ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, + false)); if(!self->mRing) { ERR("Ring buffer create failed\n"); @@ -739,13 +738,13 @@ void ALCcaptureOSS_stop(ALCcaptureOSS *self) ALCenum ALCcaptureOSS_captureSamples(ALCcaptureOSS *self, ALCvoid *buffer, ALCuint samples) { - ll_ringbuffer_read(self->mRing, static_cast<char*>(buffer), samples); + ll_ringbuffer_read(self->mRing.get(), static_cast<char*>(buffer), samples); return ALC_NO_ERROR; } ALCuint ALCcaptureOSS_availableSamples(ALCcaptureOSS *self) { - return ll_ringbuffer_read_space(self->mRing); + return ll_ringbuffer_read_space(self->mRing.get()); } } // namespace |