[PATCH 1/2] format: Make pa_format_info_valid() stricter for PCM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Arun Raghavan <git@xxxxxxxxxxxxxxxx>

We should do stricter validation when we can.
---
 src/pulse/format.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/pulse/format.c b/src/pulse/format.c
index c2a1552..b07940a 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -101,7 +101,13 @@ void pa_format_info_free(pa_format_info *f) {
 }
 
 int pa_format_info_valid(const pa_format_info *f) {
-    return (f->encoding >= 0 && f->encoding < PA_ENCODING_MAX && f->plist != NULL);
+    pa_sample_spec ss;
+
+    if (pa_format_info_is_pcm(f)) {
+        pa_format_info_to_sample_spec(f, &ss, NULL);
+        return pa_sample_spec_valid(&ss);
+    } else
+        return (f->encoding >= 0 && f->encoding < PA_ENCODING_MAX && f->plist != NULL);
 }
 
 int pa_format_info_is_pcm(const pa_format_info *f) {
-- 
2.5.0



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux