diff options
author | Andreas Huber <andih@google.com> | 2012-08-30 10:56:14 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-08-30 10:56:14 -0700 |
commit | 082830f92373a1b9e512dbbfb940187ffa1c2c6f (patch) | |
tree | 46124186416264ddfe73a0dfabe4974777ff0405 /include | |
parent | e05a679401c7baeb0f82ce105eb20ae1ec863cdf (diff) | |
download | frameworks_av-082830f92373a1b9e512dbbfb940187ffa1c2c6f.zip frameworks_av-082830f92373a1b9e512dbbfb940187ffa1c2c6f.tar.gz frameworks_av-082830f92373a1b9e512dbbfb940187ffa1c2c6f.tar.bz2 |
Prepare for transmitting audio through AudioSource.
AudioSource can now be configured to output buffers timestamped based
on looper time (absolute) instead of based on systemTime() relative to
start time.
Change-Id: I8eca42648eb50033ac4aafbe5daac64a98a40690
Diffstat (limited to 'include')
-rw-r--r-- | include/media/stagefright/AudioSource.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/media/stagefright/AudioSource.h b/include/media/stagefright/AudioSource.h index f5466e8..de7edf3 100644 --- a/include/media/stagefright/AudioSource.h +++ b/include/media/stagefright/AudioSource.h @@ -31,11 +31,12 @@ namespace android { class AudioRecord; struct AudioSource : public MediaSource, public MediaBufferObserver { - // Note that the "channels" parameter is _not_ the number of channels, - // but a bitmask of audio_channels_t constants. + // Note that the "channels" parameter _is_ the number of channels, + // _not_ a bitmask of audio_channels_t constants. AudioSource( - audio_source_t inputSource, uint32_t sampleRate, - uint32_t channels = AUDIO_CHANNEL_IN_MONO); + audio_source_t inputSource, + uint32_t sampleRate, + uint32_t channels = 1); status_t initCheck() const; @@ -49,9 +50,15 @@ struct AudioSource : public MediaSource, public MediaBufferObserver { virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); - status_t dataCallbackTimestamp(const AudioRecord::Buffer& buffer, int64_t timeUs); + status_t dataCallback(const AudioRecord::Buffer& buffer); virtual void signalBufferReturned(MediaBuffer *buffer); + // If useLooperTime == true, buffers will carry absolute timestamps + // as returned by ALooper::GetNowUs(), otherwise systemTime() is used + // and buffers contain timestamps relative to start time. + // The default is to _not_ use looper time. + void setUseLooperTime(bool useLooperTime); + protected: virtual ~AudioSource(); @@ -87,6 +94,8 @@ private: List<MediaBuffer * > mBuffersReceived; + bool mUseLooperTime; + void trackMaxAmplitude(int16_t *data, int nSamples); // This is used to raise the volume from mute to the |