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

Commit 9d480895 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

Fix CalledFromWrongThreadException in MediaPlayer's subtitle support



Call selectTrack/setSubtitleWidget only from MP's looper or the
applications's event thread, which is the same for now (we only
support subtitles in VideoView.)

Change-Id: Ic1de923b801f28657f37e0330b95c321931a6960
Signed-off-by: default avatarLajos Molnar <lajos@google.com>
Bug: 10691837
Bug: 10326117
parent 737d2c0b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1819,8 +1819,6 @@ public class MediaPlayer implements SubtitleController.Listener
                scanner.close();
                mOutOfBandSubtitleTracks.add(track);
                track.onData(contents, true /* eos */, ~0 /* runID: keep forever */);
                // update default track selection
                mSubtitleController.selectDefaultTrack();
                return MEDIA_INFO_EXTERNAL_METADATA_UPDATE;
            }

@@ -2232,9 +2230,12 @@ public class MediaPlayer implements SubtitleController.Listener
                    break;
                case MEDIA_INFO_METADATA_UPDATE:
                    scanInternalSubtitleTracks();
                    break;
                    // fall through

                case MEDIA_INFO_EXTERNAL_METADATA_UPDATE:
                    msg.arg1 = MEDIA_INFO_METADATA_UPDATE;
                    // update default track selection
                    mSubtitleController.selectDefaultTrack();
                    break;
                }