From 3e4766ffaaa3716b41a3506f735ef1f3c31a2f8c Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Wed, 27 Feb 2019 21:59:44 +0100 Subject: [PATCH] [outputs] Fix segfault if encode_reset() fails to setup an encode_ctx --- src/outputs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/outputs.c b/src/outputs.c index 6bde6c51..f1f5566f 100644 --- a/src/outputs.c +++ b/src/outputs.c @@ -223,10 +223,20 @@ quality_to_xcode(struct media_quality *quality) return XCODE_PCM16_44100; if (quality->sample_rate == 44100 && quality->bits_per_sample == 24) return XCODE_PCM24_44100; + if (quality->sample_rate == 44100 && quality->bits_per_sample == 32) + return XCODE_PCM32_44100; if (quality->sample_rate == 48000 && quality->bits_per_sample == 16) return XCODE_PCM16_48000; if (quality->sample_rate == 48000 && quality->bits_per_sample == 24) return XCODE_PCM24_48000; + if (quality->sample_rate == 48000 && quality->bits_per_sample == 32) + return XCODE_PCM32_48000; + if (quality->sample_rate == 96000 && quality->bits_per_sample == 16) + return XCODE_PCM16_96000; + if (quality->sample_rate == 96000 && quality->bits_per_sample == 24) + return XCODE_PCM24_96000; + if (quality->sample_rate == 96000 && quality->bits_per_sample == 32) + return XCODE_PCM32_96000; return XCODE_UNKNOWN; } @@ -310,6 +320,9 @@ buffer_fill(struct output_buffer *obuf, void *buf, size_t bufsize, struct media_ if (quality_is_equal(&output_quality_subscriptions[i].quality, quality)) continue; // Skip, no resampling required and we have the data in element 0 + if (!output_quality_subscriptions[i].encode_ctx) + continue; + frame = transcode_frame_new(buf, bufsize, nsamples, quality->sample_rate, quality->bits_per_sample); if (!frame) continue;