subtitlecomposer/0007-VideoPlayer-check-return-of-swr_alloc_set_opts2.patch
Christophe Marin 7e2072f1f1 - Add patch to fix build with pocketsphinx 5.0.3 in TW since
the API changed in the 5.0.0 release. Also, removed some
  parameters that don't seem to be configurable by pocketsphinx
  anymore:
  * use-pocketsphinx-5.0.0-api.patch

OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/subtitlecomposer?expand=0&rev=47
2024-12-24 11:58:10 +00:00

32 lines
1.4 KiB
Diff

From 5ad0c6046828f842650de39438afa276902e1c94 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:18:38 +0200
Subject: [PATCH 07/11] VideoPlayer: check return of swr_alloc_set_opts2()
This probably makes no difference but its more correct
---
src/videoplayer/backend/audiodecoder.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/videoplayer/backend/audiodecoder.cpp b/src/videoplayer/backend/audiodecoder.cpp
index 35144965..d4675a52 100644
--- a/src/videoplayer/backend/audiodecoder.cpp
+++ b/src/videoplayer/backend/audiodecoder.cpp
@@ -371,11 +371,11 @@ AudioDecoder::decodeFrame(Frame *af)
|| af->frame->sample_rate != m_fmtSrc.freq
|| (wantedNbSamples != af->frame->nb_samples && !m_swrCtx)) {
swr_free(&m_swrCtx);
- swr_alloc_set_opts2(&m_swrCtx,
+ int ret = swr_alloc_set_opts2(&m_swrCtx,
&m_fmtTgt.chLayout, m_fmtTgt.fmt, m_fmtTgt.freq,
&af->frame->ch_layout, AVSampleFormat(af->frame->format), af->frame->sample_rate,
0, nullptr);
- if(!m_swrCtx || swr_init(m_swrCtx) < 0) {
+ if(ret < 0 || !m_swrCtx || swr_init(m_swrCtx) < 0) {
av_log(nullptr, AV_LOG_ERROR,
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
af->frame->sample_rate, av_get_sample_fmt_name((AVSampleFormat)af->frame->format),
--
2.46.0