update embytv semaphore

pull/702/head
Luke Pulverenti 8 years ago
parent fa24cd65af
commit b300da2dee

@ -941,21 +941,20 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
await _liveStreamsSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); await _liveStreamsSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
var result = _liveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase)); var result = _liveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
if (result != null && result.EnableStreamSharing) if (result != null && result.EnableStreamSharing)
{ {
var openedMediaSource = CloneMediaSource(result.OpenedMediaSource, result.EnableStreamSharing); var openedMediaSource = CloneMediaSource(result.OpenedMediaSource, result.EnableStreamSharing);
result.SharedStreamIds.Add(openedMediaSource.Id); result.SharedStreamIds.Add(openedMediaSource.Id);
_liveStreamsSemaphore.Release();
_logger.Info("Live stream {0} consumer count is now {1}", streamId, result.ConsumerCount); _logger.Info("Live stream {0} consumer count is now {1}", streamId, result.ConsumerCount);
return new Tuple<LiveStream, MediaSourceInfo, ITunerHost>(result, openedMediaSource, result.TunerHost); return new Tuple<LiveStream, MediaSourceInfo, ITunerHost>(result, openedMediaSource, result.TunerHost);
} }
try
{
foreach (var hostInstance in _liveTvManager.TunerHosts) foreach (var hostInstance in _liveTvManager.TunerHosts)
{ {
try try
@ -1271,6 +1270,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try try
{ {
var recorder = await GetRecorder().ConfigureAwait(false);
var allMediaSources = await GetChannelStreamMediaSources(timer.ChannelId, CancellationToken.None).ConfigureAwait(false); var allMediaSources = await GetChannelStreamMediaSources(timer.ChannelId, CancellationToken.None).ConfigureAwait(false);
var liveStreamInfo = await GetChannelStreamInternal(timer.ChannelId, allMediaSources[0].Id, CancellationToken.None) var liveStreamInfo = await GetChannelStreamInternal(timer.ChannelId, allMediaSources[0].Id, CancellationToken.None)
@ -1282,8 +1283,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
// HDHR doesn't seem to release the tuner right away after first probing with ffmpeg // HDHR doesn't seem to release the tuner right away after first probing with ffmpeg
//await Task.Delay(3000, cancellationToken).ConfigureAwait(false); //await Task.Delay(3000, cancellationToken).ConfigureAwait(false);
var recorder = await GetRecorder().ConfigureAwait(false);
recordPath = recorder.GetOutputPath(mediaStreamInfo, recordPath); recordPath = recorder.GetOutputPath(mediaStreamInfo, recordPath);
recordPath = EnsureFileUnique(recordPath, timer.Id); recordPath = EnsureFileUnique(recordPath, timer.Id);

Loading…
Cancel
Save