diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-03-19 18:04:43 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-03-19 18:04:43 +0100 |
commit | 30455ab7403a9f48b7ef6d51ee43e972c78b1018 (patch) | |
tree | 7a9e8fe643c5cc3d5928aae13a101a150d3bb75b /src/AlsaInput.h | |
parent | ecc1a7dd8e9bc7818bf101e192ae075ecc104d77 (diff) | |
download | ODR-AudioEnc-30455ab7403a9f48b7ef6d51ee43e972c78b1018.tar.gz ODR-AudioEnc-30455ab7403a9f48b7ef6d51ee43e972c78b1018.tar.bz2 ODR-AudioEnc-30455ab7403a9f48b7ef6d51ee43e972c78b1018.zip |
Improve alsa fault detection
Diffstat (limited to 'src/AlsaInput.h')
-rw-r--r-- | src/AlsaInput.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/AlsaInput.h b/src/AlsaInput.h index 86844d0..0d454a3 100644 --- a/src/AlsaInput.h +++ b/src/AlsaInput.h @@ -60,7 +60,7 @@ class AlsaInput virtual void start() = 0; protected: - size_t m_read(uint8_t* buf, snd_pcm_uframes_t length); + ssize_t m_read(uint8_t* buf, snd_pcm_uframes_t length); string m_alsa_dev; unsigned int m_channels; @@ -87,7 +87,7 @@ class AlsaInputDirect : public AlsaInput * * Returns the number of bytes read. */ - size_t read(uint8_t* buf, size_t length); + ssize_t read(uint8_t* buf, size_t length); private: AlsaInputDirect(const AlsaInputDirect& other) : @@ -102,6 +102,7 @@ class AlsaInputThreaded : public AlsaInput unsigned int rate, SampleQueue<uint8_t>& queue) : AlsaInput(alsa_dev, channels, rate), + m_fault(false), m_running(false), m_queue(queue) { } @@ -116,6 +117,8 @@ class AlsaInputThreaded : public AlsaInput virtual void start(); + bool fault_detected() { return m_fault; }; + private: AlsaInputThreaded(const AlsaInputThreaded& other) : AlsaInput("", 0, 0), @@ -123,6 +126,7 @@ class AlsaInputThreaded : public AlsaInput void process(); + bool m_fault; bool m_running; boost::thread m_thread; |