summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-04-13 16:50:19 -0700
committerEric Laurent <elaurent@google.com>2012-04-20 14:17:02 -0700
commit1948eb3ea6eee336e8cdab9b0c693f93f5f19993 (patch)
tree448eed49a4ba18fb1ab4f2fb1b2c0d5cef6d242f /include/media
parent21e8c50bd13ebe44f3088e26c9c6df0e163c469c (diff)
downloadframeworks_av-1948eb3ea6eee336e8cdab9b0c693f93f5f19993.zip
frameworks_av-1948eb3ea6eee336e8cdab9b0c693f93f5f19993.tar.gz
frameworks_av-1948eb3ea6eee336e8cdab9b0c693f93f5f19993.tar.bz2
Add support for deep audio buffers
Allow AudioSink to use deep audio buffering when the source is audio only and its duration is more than a certain threshold. This helps improve battery life but implies higher audio latency. Change-Id: Ie79915b61c370292f05aabda9779356570e03cbb
Diffstat (limited to 'include/media')
-rw-r--r--include/media/MediaPlayerInterface.h6
-rw-r--r--include/media/stagefright/AudioPlayer.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 9a8f4b0..a70fe8c 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -63,6 +63,9 @@ enum player_type {
// when the channel mask isn't known, use the channel count to derive a mask in AudioSink::open()
#define CHANNEL_MASK_USE_CHANNEL_ORDER 0
+// duration below which we do not allow deep audio buffering
+#define AUDIO_SINK_MIN_DEEP_BUFFER_DURATION_US 5000000
+
// callback mechanism for passing messages to MediaPlayer object
typedef void (*notify_callback_f)(void* cookie,
int msg, int ext1, int ext2, const Parcel *obj);
@@ -98,7 +101,8 @@ public:
audio_format_t format=AUDIO_FORMAT_PCM_16_BIT,
int bufferCount=DEFAULT_AUDIOSINK_BUFFERCOUNT,
AudioCallback cb = NULL,
- void *cookie = NULL) = 0;
+ void *cookie = NULL,
+ audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE) = 0;
virtual void start() = 0;
virtual ssize_t write(const void* buffer, size_t size) = 0;
diff --git a/include/media/stagefright/AudioPlayer.h b/include/media/stagefright/AudioPlayer.h
index 70c47ae..9e8e4bb 100644
--- a/include/media/stagefright/AudioPlayer.h
+++ b/include/media/stagefright/AudioPlayer.h
@@ -37,6 +37,7 @@ public:
};
AudioPlayer(const sp<MediaPlayerBase::AudioSink> &audioSink,
+ bool allowDeepBuffering = false,
AwesomePlayer *audioObserver = NULL);
virtual ~AudioPlayer();
@@ -95,6 +96,8 @@ private:
MediaBuffer *mFirstBuffer;
sp<MediaPlayerBase::AudioSink> mAudioSink;
+ bool mAllowDeepBuffering; // allow audio deep audio buffers. Helps with low power audio
+ // playback but implies high latency
AwesomePlayer *mObserver;
static void AudioCallback(int event, void *user, void *info);