diff mbox series

[meta-multimedia] webrtc-audio-processing: Fix build with -Werror=return-type

Message ID 20230917105434.677860-1-martin.jansa@gmail.com
State Under Review
Headers show
Series [meta-multimedia] webrtc-audio-processing: Fix build with -Werror=return-type | expand

Commit Message

Martin Jansa Sept. 17, 2023, 10:54 a.m. UTC
* apply the work around from:
  https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/merge_requests/28
  which is still needed for 1.3 version:

  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc: In function 'float webrtc::{anonymous}::GetLevel(const webrtc::VadLevelAnalyzer::Result&, LevelEstimatorType)':
  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc:45:1: error: control reaches end of non-void function [-Werror=return-type]
     45 | }
        | ^
  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc: In function 'webrtc::GainControl::Mode webrtc::{anonymous}::Agc1ConfigModeToInterfaceMode(webrtc::AudioProcessing::Config::GainController1::Mode)':
  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc:117:1: error: control reaches end of non-void function [-Werror=return-type]
    117 | }
        | ^
  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc: In lambda function:
  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc:1853:13: error: control reaches end of non-void function  -Werror=return-type]
   1853 |             default:
        |             ^~~~~~~

* this can now be dropped from meta-webosose, where it was since:
  https://github.com/webosose/meta-webosose/commit/c2a24372e9f792bc900939a6642e64c459073b36#diff-c367f86896c48beb338dac912d3bf03e07d92c8345fa08dc3dcd93093a949c16

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
 .../0001-Fix-return-type-errors.patch         | 95 +++++++++++++++++++
 .../webrtc-audio-processing-1_1.3.bb          |  5 +-
 2 files changed, 98 insertions(+), 2 deletions(-)
 create mode 100644 meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1/0001-Fix-return-type-errors.patch
diff mbox series

Patch

diff --git a/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1/0001-Fix-return-type-errors.patch b/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1/0001-Fix-return-type-errors.patch
new file mode 100644
index 0000000000..37b4db6894
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1/0001-Fix-return-type-errors.patch
@@ -0,0 +1,95 @@ 
+From b6ad4b7086a6487b36d626248322f4c9d5bf420a Mon Sep 17 00:00:00 2001
+From: "thomas.georgec" <thomas.georgec@lge.com>
+Date: Sun, 12 Mar 2023 14:28:50 +0530
+Subject: [PATCH] Fix return-type errors
+
+Fix "control reaches end of non-void function" in code when -Werror=return-type
+is used.
+
+  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc: In function 'float webrtc::{anonymous}::GetLevel(const webrtc::VadLevelAnalyzer::Result&, LevelEstimatorType)':
+  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc:45:1: error: control reaches end of non-void function [-Werror=return-type]
+     45 | }
+        | ^
+  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc: In function 'webrtc::GainControl::Mode webrtc::{anonymous}::Agc1ConfigModeToInterfaceMode(webrtc::AudioProcessing::Config::GainController1::Mode)':
+  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc:117:1: error: control reaches end of non-void function [-Werror=return-type]
+    117 | }
+        | ^
+  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc: In lambda function:
+  webrtc-audio-processing-1.3/webrtc/modules/audio_processing/audio_processing_impl.cc:1853:13: error: control reaches end of non-void function  -Werror=return-type]
+   1853 |             default:
+        |             ^~~~~~~
+
+Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
+---
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/merge_requests/28]
+
+ .../audio_processing/agc2/adaptive_mode_level_estimator.cc  | 2 ++
+ webrtc/modules/audio_processing/audio_processing_impl.cc    | 3 +++
+ webrtc/modules/audio_processing/include/audio_processing.cc | 6 ++++++
+ 3 files changed, 11 insertions(+)
+
+diff --git a/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc b/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc
+index f09f63b..9cdf6ca 100644
+--- a/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc
++++ b/webrtc/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc
+@@ -42,6 +42,8 @@ float GetLevel(const VadLevelAnalyzer::Result& vad_level,
+       return vad_level.peak_dbfs;
+       break;
+   }
++  RTC_NOTREACHED();
++  __builtin_unreachable ();
+ }
+ 
+ }  // namespace
+diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
+index 67208df..3b8262a 100644
+--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
++++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
+@@ -114,6 +114,8 @@ GainControl::Mode Agc1ConfigModeToInterfaceMode(
+     case Agc1Config::kFixedDigital:
+       return GainControl::kFixedDigital;
+   }
++  RTC_NOTREACHED();
++  __builtin_unreachable ();
+ }
+ 
+ // Maximum lengths that frame of samples being passed from the render side to
+@@ -1852,6 +1854,7 @@ void AudioProcessingImpl::InitializeNoiseSuppressor() {
+               return NsConfig::SuppressionLevel::k21dB;
+             default:
+               RTC_NOTREACHED();
++              __builtin_unreachable ();
+           }
+         };
+ 
+diff --git a/webrtc/modules/audio_processing/include/audio_processing.cc b/webrtc/modules/audio_processing/include/audio_processing.cc
+index 8854415..cc8752b 100644
+--- a/webrtc/modules/audio_processing/include/audio_processing.cc
++++ b/webrtc/modules/audio_processing/include/audio_processing.cc
+@@ -28,6 +28,8 @@ std::string NoiseSuppressionLevelToString(
+     case AudioProcessing::Config::NoiseSuppression::Level::kVeryHigh:
+       return "VeryHigh";
+   }
++  RTC_NOTREACHED();
++  __builtin_unreachable ();
+ }
+ 
+ std::string GainController1ModeToString(
+@@ -40,6 +42,8 @@ std::string GainController1ModeToString(
+     case AudioProcessing::Config::GainController1::Mode::kFixedDigital:
+       return "FixedDigital";
+   }
++  RTC_NOTREACHED();
++  __builtin_unreachable ();
+ }
+ 
+ std::string GainController2LevelEstimatorToString(
+@@ -50,6 +54,8 @@ std::string GainController2LevelEstimatorToString(
+     case AudioProcessing::Config::GainController2::LevelEstimator::kPeak:
+       return "Peak";
+   }
++  RTC_NOTREACHED();
++  __builtin_unreachable ();
+ }
+ 
+ int GetDefaultMaxInternalRate() {
diff --git a/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1_1.3.bb b/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1_1.3.bb
index 8d281dad5b..c56ca53f89 100644
--- a/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1_1.3.bb
+++ b/meta-multimedia/recipes-multimedia/webrtc-audio-processing/webrtc-audio-processing-1_1.3.bb
@@ -9,8 +9,9 @@  LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://COPYING;md5=da08a38a32a340c5d91e13ee86a118f2"
 
 SRC_URI = " \
-	http://freedesktop.org/software/pulseaudio/webrtc-audio-processing/webrtc-audio-processing-${PV}.tar.xz \
-	file://0001-add-missing-header-for-musl.patch \
+    http://freedesktop.org/software/pulseaudio/webrtc-audio-processing/webrtc-audio-processing-${PV}.tar.xz \
+    file://0001-add-missing-header-for-musl.patch \
+    file://0001-Fix-return-type-errors.patch \
 "
 SRC_URI[sha256sum] = "2365e93e778d7b61b5d6e02d21c47d97222e9c7deff9e1d0838ad6ec2e86f1b9"
 S = "${WORKDIR}/webrtc-audio-processing-${PV}"