[Multimedia] Fixed a deadlock issue of Player.SetPlayPositionAsync. 50/152650/1
authorcoderhyme <jhyo.kim@samsung.com>
Tue, 26 Sep 2017 22:31:44 +0000 (07:31 +0900)
committercoderhyme <jhyo.kim@samsung.com>
Tue, 26 Sep 2017 22:31:44 +0000 (07:31 +0900)
It occurs when the continuation of task is syncrhonous, which is not always.

The callback in native holds a mutex, if user code tries to call SetPlayPositionAsync right after awaiting SetPlayPositionAsync. It could be blocked, the mutex is still locked.

Change-Id: Ia968ab8d6e01401d3e5ee6551ebf8ae62ac99ea1
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
src/Tizen.Multimedia.MediaPlayer/Player/Player.cs

index 7dd4035..680716b 100644 (file)
@@ -523,7 +523,7 @@ namespace Tizen.Multimedia
         {
             ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
 
-            var taskCompletionSource = new TaskCompletionSource<bool>();
+            var taskCompletionSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
 
             bool immediateResult = _source is MediaStreamSource;