Loading include/media/nbaio/AudioStreamOutSink.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: // This is an over-estimate, and could dupe the caller into making a blocking write() // FIXME Use an audio HAL API to query the buffer emptying status when it's available. virtual ssize_t availableToWrite() const { return mStreamBufferSizeBytes / mFrameSize; } virtual ssize_t availableToWrite() { return mStreamBufferSizeBytes / mFrameSize; } virtual ssize_t write(const void *buffer, size_t count); Loading include/media/nbaio/LibsndfileSink.h +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ public: //virtual size_t framesWritten() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; //virtual ssize_t availableToWrite() const; //virtual ssize_t availableToWrite(); virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); Loading include/media/nbaio/MonoPipe.h +9 −11 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ #define ANDROID_AUDIO_MONO_PIPE_H #include <time.h> #include "NBAIO.h" #include <audio_utils/fifo.h> #include <media/SingleStateQueue.h> #include "NBAIO.h" namespace android { Loading Loading @@ -55,7 +56,10 @@ public: //virtual int64_t framesUnderrun() const; //virtual int64_t underruns() const; virtual ssize_t availableToWrite() const; // returns n where 0 <= n <= mMaxFrames, or a negative status_t // including the private status codes in NBAIO.h virtual ssize_t availableToWrite(); virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); Loading @@ -80,16 +84,10 @@ public: status_t getTimestamp(ExtendedTimestamp ×tamp); private: const size_t mReqFrames; // as requested in constructor, unrounded const size_t mMaxFrames; // always a power of 2 const size_t mMaxFrames; // as requested in constructor, rounded up to a power of 2 void * const mBuffer; // mFront and mRear will never be separated by more than mMaxFrames. // 32-bit overflow is possible if the pipe is active for a long time, but if that happens it's // safe because we "&" with (mMaxFrames-1) at end of computations to calculate a buffer index. volatile int32_t mFront; // written by reader with android_atomic_release_store, // read by writer with android_atomic_acquire_load volatile int32_t mRear; // written by writer with android_atomic_release_store, // read by reader with android_atomic_acquire_load audio_utils_fifo mFifo; audio_utils_fifo_writer mFifoWriter; bool mWriteTsValid; // whether mWriteTs is valid struct timespec mWriteTs; // time that the previous write() completed size_t mSetpoint; // target value for pipe fill depth Loading include/media/nbaio/MonoPipeReader.h +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class MonoPipeReader : public NBAIO_Source { public: // Construct a MonoPipeReader and associate it with a MonoPipe; // any data already in the pipe is visible to this PipeReader. // any data already in the pipe is visible to this MonoPipeReader. // There can be only a single MonoPipeReader per MonoPipe. // FIXME make this constructor a factory method of MonoPipe. MonoPipeReader(MonoPipe* pipe); Loading Loading @@ -59,6 +59,7 @@ public: private: MonoPipe * const mPipe; audio_utils_fifo_reader mFifoReader; }; } // namespace android Loading include/media/nbaio/NBAIO.h +6 −1 Original line number Diff line number Diff line Loading @@ -164,7 +164,12 @@ public: // UNDERRUN write() has not been called frequently enough, or with enough frames to keep up. // An underrun event is counted, and the caller should re-try this operation. // WOULD_BLOCK Determining how many frames can be written without blocking would itself block. virtual ssize_t availableToWrite() const { return SSIZE_MAX; } virtual ssize_t availableToWrite() { if (!mNegotiated) { return NEGOTIATE; } return SSIZE_MAX; } // Transfer data to sink from single input buffer. Implies a copy. // Inputs: Loading Loading
include/media/nbaio/AudioStreamOutSink.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: // This is an over-estimate, and could dupe the caller into making a blocking write() // FIXME Use an audio HAL API to query the buffer emptying status when it's available. virtual ssize_t availableToWrite() const { return mStreamBufferSizeBytes / mFrameSize; } virtual ssize_t availableToWrite() { return mStreamBufferSizeBytes / mFrameSize; } virtual ssize_t write(const void *buffer, size_t count); Loading
include/media/nbaio/LibsndfileSink.h +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ public: //virtual size_t framesWritten() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; //virtual ssize_t availableToWrite() const; //virtual ssize_t availableToWrite(); virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); Loading
include/media/nbaio/MonoPipe.h +9 −11 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ #define ANDROID_AUDIO_MONO_PIPE_H #include <time.h> #include "NBAIO.h" #include <audio_utils/fifo.h> #include <media/SingleStateQueue.h> #include "NBAIO.h" namespace android { Loading Loading @@ -55,7 +56,10 @@ public: //virtual int64_t framesUnderrun() const; //virtual int64_t underruns() const; virtual ssize_t availableToWrite() const; // returns n where 0 <= n <= mMaxFrames, or a negative status_t // including the private status codes in NBAIO.h virtual ssize_t availableToWrite(); virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); Loading @@ -80,16 +84,10 @@ public: status_t getTimestamp(ExtendedTimestamp ×tamp); private: const size_t mReqFrames; // as requested in constructor, unrounded const size_t mMaxFrames; // always a power of 2 const size_t mMaxFrames; // as requested in constructor, rounded up to a power of 2 void * const mBuffer; // mFront and mRear will never be separated by more than mMaxFrames. // 32-bit overflow is possible if the pipe is active for a long time, but if that happens it's // safe because we "&" with (mMaxFrames-1) at end of computations to calculate a buffer index. volatile int32_t mFront; // written by reader with android_atomic_release_store, // read by writer with android_atomic_acquire_load volatile int32_t mRear; // written by writer with android_atomic_release_store, // read by reader with android_atomic_acquire_load audio_utils_fifo mFifo; audio_utils_fifo_writer mFifoWriter; bool mWriteTsValid; // whether mWriteTs is valid struct timespec mWriteTs; // time that the previous write() completed size_t mSetpoint; // target value for pipe fill depth Loading
include/media/nbaio/MonoPipeReader.h +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class MonoPipeReader : public NBAIO_Source { public: // Construct a MonoPipeReader and associate it with a MonoPipe; // any data already in the pipe is visible to this PipeReader. // any data already in the pipe is visible to this MonoPipeReader. // There can be only a single MonoPipeReader per MonoPipe. // FIXME make this constructor a factory method of MonoPipe. MonoPipeReader(MonoPipe* pipe); Loading Loading @@ -59,6 +59,7 @@ public: private: MonoPipe * const mPipe; audio_utils_fifo_reader mFifoReader; }; } // namespace android Loading
include/media/nbaio/NBAIO.h +6 −1 Original line number Diff line number Diff line Loading @@ -164,7 +164,12 @@ public: // UNDERRUN write() has not been called frequently enough, or with enough frames to keep up. // An underrun event is counted, and the caller should re-try this operation. // WOULD_BLOCK Determining how many frames can be written without blocking would itself block. virtual ssize_t availableToWrite() const { return SSIZE_MAX; } virtual ssize_t availableToWrite() { if (!mNegotiated) { return NEGOTIATE; } return SSIZE_MAX; } // Transfer data to sink from single input buffer. Implies a copy. // Inputs: Loading