NuPlayer: fix notification when one track is not played.
One track is not played because it has no sink component.
Test: pass failed cts test
Bug: 37216899
Bug: 24761723
Change-Id: I669d59d6c193794da8973b9dd58bc8eac0b51996
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index d9a5c26..d048777 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1159,7 +1159,8 @@
}
if (mSource != nullptr) {
if (audio) {
- if (mVideoDecoderError || mSource->getFormat(false /* audio */) == NULL) {
+ if (mVideoDecoderError || mSource->getFormat(false /* audio */) == NULL
+ || mSurface == NULL) {
// When both audio and video have error, or this stream has only audio
// which has error, notify client of error.
notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
@@ -1169,7 +1170,8 @@
}
mAudioDecoderError = true;
} else {
- if (mAudioDecoderError || mSource->getFormat(true /* audio */) == NULL) {
+ if (mAudioDecoderError || mSource->getFormat(true /* audio */) == NULL
+ || mAudioSink == NULL) {
// When both audio and video have error, or this stream has only video
// which has error, notify client of error.
notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);