summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-08-06 12:51:20 +0200
committerWim Taymans <wtaymans@redhat.com>2020-08-06 12:51:20 +0200
commit4b56574ce09845e40992705b5fdd829a0899ef30 (patch)
treebe0e395f51df126f4393c30cfc863de48d600d04
parent8a9bb9dabba459dfd41c42e2d33ed4d7d4c109cb (diff)
policy-node: don't fail on incomplete format
Use some defaults when parsing the audio format.
-rw-r--r--src/examples/media-session/policy-node.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/examples/media-session/policy-node.c b/src/examples/media-session/policy-node.c
index f4b8c3b8..ca54bf6a 100644
--- a/src/examples/media-session/policy-node.c
+++ b/src/examples/media-session/policy-node.c
@@ -101,6 +101,7 @@ struct node {
static bool find_format(struct node *node)
{
+ struct impl *impl = node->impl;
struct sm_param *p;
bool have_format = false;
@@ -121,8 +122,14 @@ static bool find_format(struct node *node)
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_pod(2, NULL, p->param);
- if (spa_format_audio_raw_parse(p->param, &info.info.raw) < 0)
- continue;
+ /* defaults */
+ info.info.raw.format = SPA_AUDIO_FORMAT_F32;
+ info.info.raw.rate = impl->sample_rate;
+ info.info.raw.channels = 2;
+ info.info.raw.position[0] = SPA_AUDIO_CHANNEL_FL;
+ info.info.raw.position[1] = SPA_AUDIO_CHANNEL_FR;
+
+ spa_format_audio_raw_parse(p->param, &info.info.raw);
if (node->format.info.raw.channels < info.info.raw.channels)
node->format = info;