Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 329eec53 authored by Andreas Huber's avatar Andreas Huber
Browse files

Fix invocation of notification callback in case the callback is modified

from a separate thread.

Change-Id: I741c1f2f9c796ec977a742a69cedcca10c5218ad
parent db7516e3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ final public class MediaCodec {
    public static final int BUFFER_FLAG_END_OF_STREAM         = 4;

    private EventHandler mEventHandler;
    private NotificationCallback mNotificationCallback;
    private volatile NotificationCallback mNotificationCallback;

    static final int EVENT_NOTIFY = 1;

@@ -194,8 +194,9 @@ final public class MediaCodec {
            switch (msg.what) {
                case EVENT_NOTIFY:
                {
                    if (mNotificationCallback != null) {
                        mNotificationCallback.onCodecNotify(mCodec);
                    NotificationCallback cb = mNotificationCallback;
                    if (cb != null) {
                        cb.onCodecNotify(mCodec);
                    }
                    break;
                }