Skip to content

Display and control your Android device

Use exact-width integer types

Romain Vimont10f60054aca7
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;