diff mbox series

[14/18] audio: Require AudioState in AUD_add_capture

Message ID c6e87e678e914df0f59da2145c2753cdb4a16f63.1650874791.git.mkletzan@redhat.com
State New
Headers show
Series RFC: Remove deprecated audio features | expand

Commit Message

Martin Kletzander April 25, 2022, 8:21 a.m. UTC
Since all callers require a valid audiodev this function can now safely
abort in case of missing AudioState.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 audio/audio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Daniel P. Berrangé April 25, 2022, 2:11 p.m. UTC | #1
On Mon, Apr 25, 2022 at 10:21:57AM +0200, Martin Kletzander wrote:
> Since all callers require a valid audiodev this function can now safely
> abort in case of missing AudioState.
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  audio/audio.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/audio/audio.c b/audio/audio.c
> index b95aca444382..97eb645764c1 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -1855,10 +1855,8 @@ CaptureVoiceOut *AUD_add_capture(
>      struct capture_callback *cb;
>  
>      if (!s) {
> -        if (!legacy_config) {
> -            dolog("Capturing without setting an audiodev is deprecated\n");
> -        }
> -        s = audio_init(NULL, NULL);
> +        error_setg(&error_abort,
> +                   "Capturing without setting an audiodev is not supported");

Preferrable to do:

  error_report("Capturing ...");
  abort();

Or pass in an 'Error **errp' parameter and let the caller decide
what todo

>      }
>  
>      if (!audio_get_pdo_out(s->dev)->mixing_engine) {
> -- 
> 2.35.1
> 

With regards,
Daniel
diff mbox series

Patch

diff --git a/audio/audio.c b/audio/audio.c
index b95aca444382..97eb645764c1 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1855,10 +1855,8 @@  CaptureVoiceOut *AUD_add_capture(
     struct capture_callback *cb;
 
     if (!s) {
-        if (!legacy_config) {
-            dolog("Capturing without setting an audiodev is deprecated\n");
-        }
-        s = audio_init(NULL, NULL);
+        error_setg(&error_abort,
+                   "Capturing without setting an audiodev is not supported");
     }
 
     if (!audio_get_pdo_out(s->dev)->mixing_engine) {