update hls streams
This commit is contained in:
parent
9d216c79bb
commit
b9935a4643
|
@ -202,7 +202,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
||||
var line = reader.ReadLine();
|
||||
|
||||
if (line.IndexOf("#EXTINF:", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
|
@ -234,11 +234,11 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
|
||||
try
|
||||
{
|
||||
return FileSystem.GetFileStream(tmpPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.Asynchronous | FileOpenOptions.SequentialScan);
|
||||
return FileSystem.GetFileStream(tmpPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.SequentialScan);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
return FileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.Asynchronous | FileOpenOptions.SequentialScan);
|
||||
return FileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.SequentialScan);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
return Path.Combine(folder, filename + index.ToString(UsCulture) + GetSegmentFileExtension(state.Request));
|
||||
}
|
||||
|
||||
private async Task<object> GetSegmentResult(StreamState state,
|
||||
private async Task<object> GetSegmentResult(StreamState state,
|
||||
string playlistPath,
|
||||
string segmentPath,
|
||||
string segmentExtension,
|
||||
|
@ -456,26 +456,20 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
{
|
||||
try
|
||||
{
|
||||
using (var fileStream = GetPlaylistFileStream(playlistPath))
|
||||
{
|
||||
using (var reader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize))
|
||||
{
|
||||
var text = await reader.ReadToEndAsync().ConfigureAwait(false);
|
||||
var text = FileSystem.ReadAllText(playlistPath, Encoding.UTF8);
|
||||
|
||||
// If it appears in the playlist, it's done
|
||||
if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
if (!segmentFileExists)
|
||||
{
|
||||
segmentFileExists = FileSystem.FileExists(segmentPath);
|
||||
}
|
||||
if (segmentFileExists)
|
||||
{
|
||||
return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
|
||||
}
|
||||
//break;
|
||||
}
|
||||
// If it appears in the playlist, it's done
|
||||
if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
if (!segmentFileExists)
|
||||
{
|
||||
segmentFileExists = FileSystem.FileExists(segmentPath);
|
||||
}
|
||||
if (segmentFileExists)
|
||||
{
|
||||
return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
|
||||
}
|
||||
//break;
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
|
|
|
@ -63,9 +63,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||
|
||||
private Stream GetInputStream(bool allowAsyncFileRead)
|
||||
{
|
||||
var fileOpenOptions = StartPosition > 0
|
||||
? FileOpenOptions.RandomAccess
|
||||
: FileOpenOptions.SequentialScan;
|
||||
var fileOpenOptions = FileOpenOptions.SequentialScan;
|
||||
|
||||
if (allowAsyncFileRead)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user