NuPlayer2: send notification on helper thread avoid deadlock.
Test: MediaPlayer2 works for local file playback
Bug: 63934228
Change-Id: Idb1f9d865f9060a3886f465147d7c1e45a669455
diff --git a/media/libmedia/nuplayer2/NuPlayer2Driver.h b/media/libmedia/nuplayer2/NuPlayer2Driver.h
index edd4556..051eba5 100644
--- a/media/libmedia/nuplayer2/NuPlayer2Driver.h
+++ b/media/libmedia/nuplayer2/NuPlayer2Driver.h
@@ -78,6 +78,8 @@
virtual status_t dump(int fd, const Vector<String16> &args) const;
+ virtual void onMessageReceived(const sp<AMessage> &msg) override;
+
void notifySetDataSourceCompleted(status_t err);
void notifyPrepareCompleted(status_t err);
void notifyResetComplete();
@@ -113,6 +115,10 @@
STATE_STOPPED_AND_PREPARED, // equivalent to PAUSED, but seek complete
};
+ enum {
+ kWhatNotifyListener,
+ };
+
mutable Mutex mLock;
Condition mCondition;
@@ -134,6 +140,7 @@
// <<<
sp<ALooper> mLooper;
+ sp<ALooper> mNuPlayer2Looper;
const sp<MediaClock> mMediaClock;
const sp<NuPlayer2> mPlayer;
sp<AudioSink> mAudioSink;
@@ -146,13 +153,13 @@
bool mLooping;
bool mAutoLoop;
-
void updateMetrics(const char *where);
void logMetrics(const char *where);
status_t prepare_l();
status_t start_l();
void notifyListener_l(int msg, int ext1 = 0, int ext2 = 0, const Parcel *in = NULL);
+ void sendNotifyOnLooper(int msgId);
DISALLOW_EVIL_CONSTRUCTORS(NuPlayer2Driver);
};