add error handling

This commit is contained in:
Luke Pulverenti 2017-02-09 18:59:27 -05:00
parent 6405f6c0c7
commit 35415d6a50
3 changed files with 35 additions and 31 deletions

View File

@ -155,6 +155,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks); var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks);
var inputModifiers = "-fflags +genpts -async 1 -vsync -1"; var inputModifiers = "-fflags +genpts -async 1 -vsync -1";
var mapArgs = string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase) ? "-map 0" : "-sn"; var mapArgs = string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase) ? "-map 0" : "-sn";
mapArgs = "-sn";
var commandLineArgs = "-i \"{0}\"{4} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; var commandLineArgs = "-i \"{0}\"{4} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3} -y \"{1}\"";
long startTimeTicks = 0; long startTimeTicks = 0;

View File

@ -50,13 +50,16 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId); var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId);
var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false); if (channel != null)
if (response != null)
{ {
imageResponse.HasImage = true; var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false);
imageResponse.Stream = response.Stream;
imageResponse.Format = response.Format; if (response != null)
{
imageResponse.HasImage = true;
imageResponse.Stream = response.Stream;
imageResponse.Format = response.Format;
}
} }
} }
catch (NotImplementedException) catch (NotImplementedException)

View File

@ -1486,33 +1486,33 @@ namespace MediaBrowser.MediaEncoding.Encoder
//inputModifier += " -noaccurate_seek"; //inputModifier += " -noaccurate_seek";
} }
if (!string.IsNullOrWhiteSpace(state.InputContainer)) //if (!string.IsNullOrWhiteSpace(state.InputContainer))
{ //{
var inputFormat = GetInputFormat(state.InputContainer); // var inputFormat = GetInputFormat(state.InputContainer);
if (!string.IsNullOrWhiteSpace(inputFormat)) // if (!string.IsNullOrWhiteSpace(inputFormat))
{ // {
inputModifier += " -f " + inputFormat; // inputModifier += " -f " + inputFormat;
} // }
} //}
if (state.RunTimeTicks.HasValue) //if (state.RunTimeTicks.HasValue)
{ //{
foreach (var stream in state.MediaSource.MediaStreams) // foreach (var stream in state.MediaSource.MediaStreams)
{ // {
if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) // if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle)
{ // {
if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) // if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1)
{ // {
var decoder = GetDecoderFromCodec(stream.Codec); // var decoder = GetDecoderFromCodec(stream.Codec);
if (!string.IsNullOrWhiteSpace(decoder)) // if (!string.IsNullOrWhiteSpace(decoder))
{ // {
inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; // inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder;
} // }
} // }
} // }
} // }
} //}
} }
return inputModifier; return inputModifier;