summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-08-30 10:56:14 -0700
committerAndreas Huber <andih@google.com>2012-08-30 10:56:14 -0700
commitbd381af4d618a4da78de99d05d44a10c0c37207b (patch)
tree9aabae3b0ee22c6bce79a40bf44512bdd77f795f /include/media
parent8dd92a89e09496a83bcd9221bf77dd607313f2e4 (diff)
downloadframeworks_av-bd381af4d618a4da78de99d05d44a10c0c37207b.zip
frameworks_av-bd381af4d618a4da78de99d05d44a10c0c37207b.tar.gz
frameworks_av-bd381af4d618a4da78de99d05d44a10c0c37207b.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/media')
-rw-r--r--include/media/stagefright/AudioSource.h19
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