[MediaPlayer] fix it to not try getting handle when format is null (#931)
authornam <36914158+aferin@users.noreply.github.com>
Wed, 17 Jul 2019 02:11:24 +0000 (11:11 +0900)
committerGitHub <noreply@github.com>
Wed, 17 Jul 2019 02:11:24 +0000 (11:11 +0900)
src/Tizen.Multimedia.MediaPlayer/Player/Player.cs

index 10f939a..27e77d4 100644 (file)
@@ -915,8 +915,6 @@ namespace Tizen.Multimedia
             ValidatePlayerState(PlayerState.Idle);
             ValidationUtil.ValidateEnum(typeof(PlayerAudioExtractOption), option, nameof(option));
 
-            IntPtr formatHandle = IntPtr.Zero;
-
             _audioFrameDecodedCallback = (IntPtr packetHandle, IntPtr userData) =>
             {
                 var handler = AudioDataDecoded;
@@ -932,10 +930,8 @@ namespace Tizen.Multimedia
                 }
             };
 
-            formatHandle = format.AsNativeHandle();
-
-            NativePlayer.SetAudioFrameDecodedCb(Handle, formatHandle, option, _audioFrameDecodedCallback, IntPtr.Zero).
-                ThrowIfFailed(this, "Failed to register the _audioFrameDecoded");
+            NativePlayer.SetAudioFrameDecodedCb(Handle, format == null ? IntPtr.Zero : format.AsNativeHandle(), option,
+                _audioFrameDecodedCallback, IntPtr.Zero).ThrowIfFailed(this, "Failed to register the _audioFrameDecoded");
         }
 
         /// <summary>