[pulseaudio-commits] src/pulsecore

Arun Raghavan arun at kemper.freedesktop.org
Fri Jun 14 21:14:03 PDT 2013


 src/pulsecore/sink-input.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 2c1dceeb58af7d1b8b855f6e90c65f8256f5c06c
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Sat Jun 15 09:42:02 2013 +0530

    sink-input: Log format negotiation better
    
    This provides more details on format negotiation success and failure to
    make debugging problems easier.

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index db29696..8666c60 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -283,7 +283,7 @@ int pa_sink_input_new(
 
     pa_sink_input *i;
     pa_resampler *resampler = NULL;
-    char st[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
+    char st[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], fmt[PA_FORMAT_INFO_SNPRINT_MAX];
     pa_channel_map original_cm;
     int r;
     char *pt;
@@ -331,7 +331,18 @@ int pa_sink_input_new(
     if (!data->format && data->nego_formats && !pa_idxset_isempty(data->nego_formats))
         data->format = pa_format_info_copy(pa_idxset_first(data->nego_formats, NULL));
 
-    pa_return_val_if_fail(data->format, -PA_ERR_NOTSUPPORTED);
+    if (PA_LIKELY(data->format)) {
+        pa_log_debug("Negotiated format: %s", pa_format_info_snprint(fmt, sizeof(fmt), data->format));
+    } else {
+        pa_format_info *format;
+        uint32_t idx;
+
+        pa_log_info("Sink does not support any requested format:");
+        PA_IDXSET_FOREACH(format, data->req_formats, idx)
+            pa_log_info(" -- %s", pa_format_info_snprint(fmt, sizeof(fmt), format));
+
+        return -PA_ERR_NOTSUPPORTED;
+    }
 
     /* Now populate the sample spec and format according to the final
      * format that we've negotiated */



More information about the pulseaudio-commits mailing list