Browse Source

properly specify audio codec even when source has correct format (#641)

pull/642/head
Jason Dove 4 years ago committed by GitHub
parent
commit
8a6093ce8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs
  2. 10
      ErsatzTV.FFmpeg/PipelineBuilder.cs

3
ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs

@ -271,7 +271,8 @@ namespace ErsatzTV.Core.Tests.FFmpeg
FFmpegProfile = FFmpegProfile.New("test", profileResolution) with FFmpegProfile = FFmpegProfile.New("test", profileResolution) with
{ {
HardwareAcceleration = profileAcceleration, HardwareAcceleration = profileAcceleration,
VideoCodec = profileCodec VideoCodec = profileCodec,
AudioCodec = "aac"
}, },
StreamingMode = StreamingMode.TransportStream StreamingMode = StreamingMode.TransportStream
}, },

10
ErsatzTV.FFmpeg/PipelineBuilder.cs

@ -360,12 +360,9 @@ public class PipelineBuilder
{ {
_pipelineSteps.Add(new EncoderCopyAudio()); _pipelineSteps.Add(new EncoderCopyAudio());
} }
else
// TODO: while?
if (!IsDesiredAudioState(currentState, desiredState))
{
if (currentState.AudioFormat != desiredState.AudioFormat)
{ {
// always need to specify audio codec so ffmpeg doesn't default to a codec we don't want
foreach (IEncoder step in AvailableEncoders.ForAudioFormat(desiredState, _logger)) foreach (IEncoder step in AvailableEncoders.ForAudioFormat(desiredState, _logger))
{ {
currentState = step.NextState(currentState); currentState = step.NextState(currentState);
@ -373,6 +370,9 @@ public class PipelineBuilder
} }
} }
// TODO: while?
if (!IsDesiredAudioState(currentState, desiredState))
{
foreach (int desiredAudioChannels in desiredState.AudioChannels) foreach (int desiredAudioChannels in desiredState.AudioChannels)
{ {
if (currentState.AudioChannels != desiredAudioChannels) if (currentState.AudioChannels != desiredAudioChannels)

Loading…
Cancel
Save