Merge "MediaCodec: Release lock before calling onFrameRendered()"
am: c03b91a7ef
Change-Id: I362a0153d83363b0c2b419480dcbe01df6976a90
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 510ee44..c9d7978 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -1702,20 +1702,22 @@
break;
}
case EVENT_FRAME_RENDERED:
- synchronized (mListenerLock) {
- Map<String, Object> map = (Map<String, Object>)msg.obj;
- for (int i = 0; ; ++i) {
- Object mediaTimeUs = map.get(i + "-media-time-us");
- Object systemNano = map.get(i + "-system-nano");
- if (mediaTimeUs == null || systemNano == null
- || mOnFrameRenderedListener == null) {
- break;
- }
- mOnFrameRenderedListener.onFrameRendered(
- mCodec, (long)mediaTimeUs, (long)systemNano);
+ Map<String, Object> map = (Map<String, Object>)msg.obj;
+ for (int i = 0; ; ++i) {
+ Object mediaTimeUs = map.get(i + "-media-time-us");
+ Object systemNano = map.get(i + "-system-nano");
+ OnFrameRenderedListener onFrameRenderedListener;
+ synchronized (mListenerLock) {
+ onFrameRenderedListener = mOnFrameRenderedListener;
}
- break;
+ if (mediaTimeUs == null || systemNano == null
+ || onFrameRenderedListener == null) {
+ break;
+ }
+ onFrameRenderedListener.onFrameRendered(
+ mCodec, (long)mediaTimeUs, (long)systemNano);
}
+ break;
default:
{
break;