diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2018-02-03 18:46:26 +0100 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2018-02-03 18:46:26 +0100 |
commit | 69452253ee62ffbc58b4e17e84a66333641a67dc (patch) | |
tree | a1a73c478d04f23564c87d5239d3ff85d629b19f /src/audio.c | |
parent | 74db759ddbed32127ae763ab72be552cff2aebcc (diff) |
audio: check sample formats
Diffstat (limited to 'src/audio.c')
-rw-r--r-- | src/audio.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/audio.c b/src/audio.c index dd5369f..358127e 100644 --- a/src/audio.c +++ b/src/audio.c @@ -522,7 +522,8 @@ static void poll_aubuf_tx(struct audio *a) aubuf_read(tx->aubuf, (uint8_t *)tx->sampv, num_bytes); } - else { + else if (tx->enc_fmt == AUFMT_S16LE) { + /* Convert from ausrc format to 16-bit format */ void *tmp_sampv; @@ -544,6 +545,11 @@ static void poll_aubuf_tx(struct audio *a) mem_deref(tmp_sampv); } + else { + warning("audio: tx: invalid sample formats (%s -> %s)\n", + aufmt_name(tx->src_fmt), + aufmt_name(tx->enc_fmt)); + } /* optional resampler */ if (tx->resamp.resample) { @@ -833,7 +839,7 @@ static int aurx_stream_decode(struct aurx *rx, struct mbuf *mb) if (err) goto out; } - else { + else if (rx->dec_fmt == AUFMT_S16LE) { /* Convert from 16-bit to auplay format */ void *tmp_sampv; @@ -860,6 +866,11 @@ static int aurx_stream_decode(struct aurx *rx, struct mbuf *mb) if (err) goto out; } + else { + warning("audio: decode: invalid sample formats (%s -> %s)\n", + aufmt_name(rx->dec_fmt), + aufmt_name(rx->play_fmt)); + } rx->aubuf_started = true; |