During playback contents with multi audio tracks or multi video tracks,
crash occurs in checkBuffering() which is added from Android-N.
The reason is because instance is not set in mSource in onConnected().
This commit adds null check to prevent crash.
Bug:
29520487
Change-Id: I893c11a7339e938b1f3b79805c2fb3d9be5cfc96
Signed-off-by: ZHU XINGYUE <zhu.x.xingyue@sonymobile.com>
size_t numTracks = mTracks.size();
size_t preparedCount, underflowCount, overflowCount, startCount;
preparedCount = underflowCount = overflowCount = startCount = 0;
- for (size_t i = 0; i < numTracks; ++i) {
+
+ size_t count = numTracks;
+ for (size_t i = 0; i < count; ++i) {
status_t finalResult;
TrackInfo *info = &mTracks.editItemAt(i);
sp<AnotherPacketSource> src = info->mSource;
+ if (src == NULL) {
+ --numTracks;
+ continue;
+ }
int64_t bufferedDurationUs = src->getBufferedDurationUs(&finalResult);
// isFinished when duration is 0 checks for EOS result only