summaryrefslogtreecommitdiff
authorZhenggang Luo <zhenggang.luo@amlogic.com>2015-05-27 11:03:00 (GMT)
committer Zhenggang Luo <zhenggang.luo@amlogic.com>2015-05-27 11:04:15 (GMT)
commitf36ea7e93580a9b52c0baec10da7192f91560347 (patch)
tree85835e0bd2e5deacd62572bd46f3f128152eb17c
parent158ba0aaa4686ff2e250101a79ecbe4adce224bb (diff)
downloadaudio-f36ea7e93580a9b52c0baec10da7192f91560347.zip
audio-f36ea7e93580a9b52c0baec10da7192f91560347.tar.gz
audio-f36ea7e93580a9b52c0baec10da7192f91560347.tar.bz2
PD#104217:fixed overflow issue in out_get_buffer_size()
Change-Id: I94efa018992f89bf1da36f9be52f45de79666a2b
Diffstat
-rw-r--r--hdmi_audio_hw.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hdmi_audio_hw.c b/hdmi_audio_hw.c
index 8cd2a6d..d534e36 100644
--- a/hdmi_audio_hw.c
+++ b/hdmi_audio_hw.c
@@ -747,13 +747,13 @@ static size_t out_get_buffer_size(const struct audio_stream *stream)
size_t size;
int codec_type=get_codec_type("/sys/class/audiodsp/digital_codec");
if(codec_type == 4 || codec_type == 5)//dd+
- size = (PERIOD_SIZE*2* PLAYBACK_PERIOD_COUNT * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
+ size = (PERIOD_SIZE*2* PLAYBACK_PERIOD_COUNT * (int64_t)DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
else if(codec_type == 7)
- size = (PERIOD_SIZE*2 * 4* PLAYBACK_PERIOD_COUNT * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
+ size = (PERIOD_SIZE*2 * 4* PLAYBACK_PERIOD_COUNT * (int64_t)DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
else if(codec_type>0 && codec_type<4 ) //dd/dts
- size = (PERIOD_SIZE*4*DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
+ size = (PERIOD_SIZE*4*(int64_t)DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
else//pcm
- size = (PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
+ size = (PERIOD_SIZE * (int64_t)DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
size = ((size + 15) / 16) * 16;
return size * audio_stream_out_frame_size(&out->stream);