summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-11-15 08:25:13 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-15 08:25:13 -0800
commit576e89b523d7705545032edc67d98d9ab1dedbd2 (patch)
tree114583cf06506be2698df0284d4b57c96e976df0 /media
parent0f1ecc2e2ff84144d5293f7f79ba895538d27f9b (diff)
parent7dae71d606ded1dbc2aa9733c3d98ffac57988f2 (diff)
downloadframeworks_av-576e89b523d7705545032edc67d98d9ab1dedbd2.zip
frameworks_av-576e89b523d7705545032edc67d98d9ab1dedbd2.tar.gz
frameworks_av-576e89b523d7705545032edc67d98d9ab1dedbd2.tar.bz2
am 7dae71d6: Merge "AwesomePlayer: correct stream type for offload" into klp-dev
* commit '7dae71d606ded1dbc2aa9733c3d98ffac57988f2': AwesomePlayer: correct stream type for offload
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.h8
-rw-r--r--media/libstagefright/AwesomePlayer.cpp8
-rw-r--r--media/libstagefright/Utils.cpp5
3 files changed, 17 insertions, 4 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 05d44d4..a486cb5 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -100,7 +100,10 @@ class MediaPlayerService : public BnMediaPlayerService
virtual void flush();
virtual void pause();
virtual void close();
- void setAudioStreamType(audio_stream_type_t streamType) { mStreamType = streamType; }
+ void setAudioStreamType(audio_stream_type_t streamType) {
+ mStreamType = streamType; }
+ virtual audio_stream_type_t getAudioStreamType() const { return mStreamType; }
+
void setVolume(float left, float right);
virtual status_t setPlaybackRatePermille(int32_t ratePermille);
status_t setAuxEffectSendLevel(float level);
@@ -207,6 +210,9 @@ class MediaPlayerService : public BnMediaPlayerService
virtual void pause() {}
virtual void close() {}
void setAudioStreamType(audio_stream_type_t streamType) {}
+ // stream type is not used for AudioCache
+ virtual audio_stream_type_t getAudioStreamType() const { return AUDIO_STREAM_DEFAULT; }
+
void setVolume(float left, float right) {}
virtual status_t setPlaybackRatePermille(int32_t ratePermille) { return INVALID_OPERATION; }
uint32_t sampleRate() const { return mSampleRate; }
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 3f64b66..130207d 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1499,7 +1499,13 @@ status_t AwesomePlayer::initAudioDecoder() {
// This doesn't guarantee that the hardware has a free stream
// but it avoids us attempting to open (and re-open) an offload
// stream to hardware that doesn't have the necessary codec
- mOffloadAudio = canOffloadStream(meta, (mVideoSource != NULL), isStreamingHTTP());
+ audio_stream_type_t streamType = AUDIO_STREAM_MUSIC;
+ if (mAudioSink != NULL) {
+ streamType = mAudioSink->getAudioStreamType();
+ }
+
+ mOffloadAudio = canOffloadStream(meta, (mVideoSource != NULL),
+ isStreamingHTTP(), streamType);
if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW)) {
ALOGV("createAudioPlayer: bypass OMX (raw)");
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index 4db8e80..9041c21 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -540,7 +540,8 @@ const struct mime_conv_t* p = &mimeLookup[0];
return BAD_VALUE;
}
-bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo, bool isStreaming)
+bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo,
+ bool isStreaming, audio_stream_type_t streamType)
{
const char *mime;
CHECK(meta->findCString(kKeyMIMEType, &mime));
@@ -594,7 +595,7 @@ bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo, bool isStreaming)
info.bit_rate = brate;
- info.stream_type = AUDIO_STREAM_MUSIC;
+ info.stream_type = streamType;
info.has_video = hasVideo;
info.is_streaming = isStreaming;