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:
parent
fe384a1600
commit
9e2d4f8b7c
1 changed files with 3 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue