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
Loading
Please register or sign in to comment