Fix issues with metadata handling when format change happens
When a video format changes, the discontinuity will clear the ATSParser
queue and format. This means that AnotherPacketSource::getFormat() will
return NULL until a new format is found. The discontinuity casues the
decoder to be shutdown and NuPlayer will start scanning sources.
But since ESQueue has not yet found any format, the call to the
StreamingSource::getFormat() will return an error (BAD_VALUE) since the
convertMetaDataToMessage() fails upon NULL input.
This error code causes the scanning of sources to stop which means that
the video will be stoped.
Instead returning -EWOULDBLOCK while waiting for a new format will keep
the scanning of source.
Bug: 32007921
Test: Manual - Install SVT Play app, start live streaming
Change-Id: Ia237825361755bc63ba34b7089e7804c187fafd8
diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
index c4147e1..47ec3e9 100644
--- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
@@ -228,6 +228,10 @@
}
sp<MetaData> meta = source->getFormat();
+ if (meta == NULL) {
+ format->setInt32("err", -EWOULDBLOCK);
+ return format;
+ }
status_t err = convertMetaDataToMessage(meta, &format);
if (err != OK) {
format->setInt32("err", err);