Merge pull request #2653 from iwalton3/fix-embedded-subtitles

Fix embedded mkv subtitles.
This commit is contained in:
Bond-009 2020-03-24 22:04:16 +01:00 committed by GitHub
commit 1345e699fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,9 +183,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
private async Task<Stream> GetSubtitleStream(string path, MediaProtocol protocol, bool requiresCharset, CancellationToken cancellationToken) private async Task<Stream> GetSubtitleStream(string path, MediaProtocol protocol, bool requiresCharset, CancellationToken cancellationToken)
{ {
using (var stream = await GetStream(path, protocol, cancellationToken).ConfigureAwait(false)) if (requiresCharset)
{ {
if (requiresCharset) using (var stream = await GetStream(path, protocol, cancellationToken).ConfigureAwait(false))
{ {
var result = CharsetDetector.DetectFromStream(stream).Detected; var result = CharsetDetector.DetectFromStream(stream).Detected;
stream.Position = 0; stream.Position = 0;
@ -200,9 +200,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
return new MemoryStream(Encoding.UTF8.GetBytes(text)); return new MemoryStream(Encoding.UTF8.GetBytes(text));
} }
} }
return stream;
} }
return File.OpenRead(path);
} }
private async Task<SubtitleInfo> GetReadableFile( private async Task<SubtitleInfo> GetReadableFile(