Fix issues crashing with Fatal signal when calling getFormat
when playing multimedia file, GenericSource::getTrackInfo run in the
NuPlayerDriver thread, and GenericSource::getFormatMeta run in the
Generic thread. they would access the critical resource which is
mMetaData in IMediaSource. There is no lock to protect mMetaData.
Occasionally, SIGSEGV occurs when mMetaData point to a new object.
Instead getting trackInfo in Generic thread.
Bug: 34220591
Signed-off-by: qinzhichao <qinzhichao@xiaomi.com>
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.h b/media/libmediaplayerservice/nuplayer/GenericSource.h
index 0957778..e92a2ae 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.h
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.h
@@ -251,6 +251,9 @@
void onGetFormatMeta(const sp<AMessage>& msg) const;
sp<MetaData> doGetFormatMeta(bool audio) const;
+ void onGetTrackInfo(const sp<AMessage>& msg) const;
+ sp<AMessage> doGetTrackInfo(size_t trackIndex) const;
+
void onGetSelectedTrack(const sp<AMessage>& msg) const;
ssize_t doGetSelectedTrack(media_track_type type) const;