summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2014-08-18 17:17:03 -0700
committerRobert Shih <robertshih@google.com>2014-08-18 18:07:45 -0700
commit9d7fc5c5fab0c7c967a625d22fffda046f9d5c29 (patch)
tree595465ca948d39b577ec6b542f5c1b85d51ff56f /media/libstagefright
parentc975c23bb9da36262b37a1d64367d726f8dd42e5 (diff)
downloadframeworks_av-9d7fc5c5fab0c7c967a625d22fffda046f9d5c29.zip
frameworks_av-9d7fc5c5fab0c7c967a625d22fffda046f9d5c29.tar.gz
frameworks_av-9d7fc5c5fab0c7c967a625d22fffda046f9d5c29.tar.bz2
HTTPLiveSource: check for NULL before getTrackCount/Info
The effect is MediaPlayer returns a 0-length array when getTrackInfo is called before PREPARED state. Bug: 12029173 Change-Id: Ib3a48525eac07b04a2ff88ce199d66dcc61c1641
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 8667a6b..7b18348 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -1019,11 +1019,19 @@ bool LiveSession::hasDynamicDuration() const {
}
size_t LiveSession::getTrackCount() const {
- return mPlaylist->getTrackCount();
+ if (mPlaylist == NULL) {
+ return 0;
+ } else {
+ return mPlaylist->getTrackCount();
+ }
}
sp<AMessage> LiveSession::getTrackInfo(size_t trackIndex) const {
- return mPlaylist->getTrackInfo(trackIndex);
+ if (mPlaylist == NULL) {
+ return NULL;
+ } else {
+ return mPlaylist->getTrackInfo(trackIndex);
+ }
}
status_t LiveSession::selectTrack(size_t index, bool select) {