Commit 18611f09 authored by Martin Finkel's avatar Martin Finkel

media: fix async usage

parent 6bc1a352
...@@ -444,10 +444,10 @@ namespace LibVLCSharp.Shared ...@@ -444,10 +444,10 @@ namespace LibVLCSharp.Shared
/// </param> /// </param>
/// <param name="cancellationToken">token to cancel the operation</param> /// <param name="cancellationToken">token to cancel the operation</param>
/// <returns>the parse status of the media</returns> /// <returns>the parse status of the media</returns>
public async Task<MediaParsedStatus> Parse(MediaParseOptions options = MediaParseOptions.ParseLocal, int timeout = -1, CancellationToken cancellationToken = default) public Task<MediaParsedStatus> Parse(MediaParseOptions options = MediaParseOptions.ParseLocal, int timeout = -1, CancellationToken cancellationToken = default)
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
var tcs = new TaskCompletionSource<MediaParsedStatus>(); var tcs = new TaskCompletionSource<MediaParsedStatus>();
var cancellationTokenRegistration = cancellationToken.Register(() => var cancellationTokenRegistration = cancellationToken.Register(() =>
{ {
...@@ -469,7 +469,7 @@ namespace LibVLCSharp.Shared ...@@ -469,7 +469,7 @@ namespace LibVLCSharp.Shared
tcs.TrySetResult(MediaParsedStatus.Failed); tcs.TrySetResult(MediaParsedStatus.Failed);
} }
return await tcs.Task.ConfigureAwait(false); return tcs.Task;
} }
finally finally
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment