Skip to content
Commit 6aee256d authored by Toshikazu Saito's avatar Toshikazu Saito Committed by Robert Shih
Browse files

Fix a dead lock for SubtitleTrack

Dead lock happens in notifyTrackData() and scheduleUpdate() of
TimeProvider. notifyTrackData() gets lock and calls SRTTrack.onData().
SRTTrack gets lock in addCue() but does not get lock in onData(). So
SRTTrack.setTimeProvider() can call before next addCue() is called.
When scheduleUpdate() is called from SRTTrack.setTimeProvider() in that
case, dead lock happens because following reason.

- TimeProvider is already gotten lock in notifyTrackData()
- scheduleUpdate() tries to get lock of TimeProvider but
  notifyTrackData() is not finished because SRTTrack.onData() waits for
  calling next addCue()
- SRTTrack waits for finishing setTimeProvider() to get lock
- setTimeProvider() is not finished because lock cannot be gotten in
  scheduleUpdate()

This fix changes the looper for SubtitleController to the looper used
in TimeProvider$EventHandler not to interrupt a message by
SubtitleController while running notifyTrackData().

Bug: 122051638
Test: check if subtitle works correctly with MediaPlayer

Change-Id: Ib77144c5adb811676899a8d7e7681045663de0d2
parent 92f69a06
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment