diff options
author | Eric Laurent <elaurent@google.com> | 2013-11-14 17:28:47 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-11-14 17:36:42 -0800 |
commit | 22612345ae97648d5b6db43cc1aa30aad77f7bba (patch) | |
tree | 73b47a621118d0fa56d27929a9447e90ca27c97d /media/libstagefright | |
parent | 4215e6166fca9f87a6e9e848b3dfd4ab0d25c954 (diff) | |
download | frameworks_av-22612345ae97648d5b6db43cc1aa30aad77f7bba.zip frameworks_av-22612345ae97648d5b6db43cc1aa30aad77f7bba.tar.gz frameworks_av-22612345ae97648d5b6db43cc1aa30aad77f7bba.tar.bz2 |
AwesomePlayer: correct stream type for offload
canOffloadStream() function in stagefright utils forces the
stream type to AUDIO_STREAM_MUSIC when querying the audio policy
manager if a particular track is offloadable or not.
This causes MP3 ringtones to be offloaded which is not a validated use case.
The fix consists in using the actual stream type read from the AudioSink.
Bug: 11410937.
Change-Id: I44b8e033a8e785a79cdc291b142f80b5580bdc4d
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 8 | ||||
-rw-r--r-- | media/libstagefright/Utils.cpp | 5 |
2 files changed, 10 insertions, 3 deletions
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; |