1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00

Avoid potential NULL dereference

This commit is contained in:
Chris Robinson 2012-12-11 19:32:10 -08:00
parent fe384a1600
commit 9e2d4f8b7c

View file

@ -142,16 +142,12 @@ namespace MWRender
}
double get_audio_clock(VideoState *is) {
double pts;
int hw_buf_size, bytes_per_sec, n;
pts = is->audio_clock; /* maintained in the audio thread */
hw_buf_size = is->audio_buf_size - is->audio_buf_index;
bytes_per_sec = 0;
n = is->audio_st->codec->channels * 2;
if(is->audio_st) {
bytes_per_sec = is->audio_st->codec->sample_rate * n;
}
if(bytes_per_sec) {
int n = is->audio_st->codec->channels * 2;
int bytes_per_sec = is->audio_st->codec->sample_rate * n;
int hw_buf_size = is->audio_buf_size - is->audio_buf_index;
pts -= (double)hw_buf_size / bytes_per_sec;
}
return pts;