From 10f60054aca70047c128fc801d103dac4d5d7896 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 23 Sep 2024 23:11:03 +0200 Subject: [PATCH] Use exact-width integer types --- app/src/audio_player.c | 8 ++++---- app/src/audio_player.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/audio_player.c b/app/src/audio_player.c index fe007832..d72dac25 100644 --- a/app/src/audio_player.c +++ b/app/src/audio_player.c @@ -342,12 +342,12 @@ sc_audio_player_frame_sink_open(struct sc_frame_sink *sink, const AVCodecContext *ctx) { struct sc_audio_player *ap = DOWNCAST(sink); #ifdef SCRCPY_LAVU_HAS_CHLAYOUT - assert(ctx->ch_layout.nb_channels > 0); - unsigned nb_channels = ctx->ch_layout.nb_channels; + assert(ctx->ch_layout.nb_channels > 0 && ctx->ch_layout.nb_channels < 256); + uint8_t nb_channels = ctx->ch_layout.nb_channels; #else int tmp = av_get_channel_layout_nb_channels(ctx->channel_layout); - assert(tmp > 0); - unsigned nb_channels = tmp; + assert(tmp > 0 && tmp < 256); + uint8_t nb_channels = tmp; #endif assert(ctx->sample_rate > 0); diff --git a/app/src/audio_player.h b/app/src/audio_player.h index 7ebb43db..c02a0d20 100644 --- a/app/src/audio_player.h +++ b/app/src/audio_player.h @@ -42,7 +42,7 @@ struct sc_audio_player { struct SwrContext *swr_ctx; // The sample rate is the same for input and output - unsigned sample_rate; + uint32_t sample_rate; // Target buffer for resampling (only used by the receiver thread) uint8_t *swr_buf;