diff options
author | Andreas Huber <andih@google.com> | 2010-10-04 11:09:31 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-10-04 11:09:31 -0700 |
commit | 6954535ba64374e4e941cd83019a7af53edfb098 (patch) | |
tree | a0466610752a3c3807e6d3f06ba302cb17b99013 | |
parent | 1fd01cbce6edb54334579f89e49a679207204619 (diff) | |
download | frameworks_av-6954535ba64374e4e941cd83019a7af53edfb098.zip frameworks_av-6954535ba64374e4e941cd83019a7af53edfb098.tar.gz frameworks_av-6954535ba64374e4e941cd83019a7af53edfb098.tar.bz2 |
Don't retrieve metadata unless necessary for ogg-vorbis ringtone auto-looping.
Change-Id: Iaf5880bb3376f9cbf22aefe198878eaf6f3f08c7
related-to-bug: 3037389
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index c955ac3..3975866 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -317,11 +317,17 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) { setAudioSource(extractor->getTrack(i)); haveAudio = true; - sp<MetaData> fileMeta = extractor->getMetaData(); - int32_t loop; - if (fileMeta != NULL - && fileMeta->findInt32(kKeyAutoLoop, &loop) && loop != 0) { - mFlags |= AUTO_LOOPING; + if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) { + // Only do this for vorbis audio, none of the other audio + // formats even support this ringtone specific hack and + // retrieving the metadata on some extractors may turn out + // to be very expensive. + sp<MetaData> fileMeta = extractor->getMetaData(); + int32_t loop; + if (fileMeta != NULL + && fileMeta->findInt32(kKeyAutoLoop, &loop) && loop != 0) { + mFlags |= AUTO_LOOPING; + } } } |