mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 00:06:43 +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 get_audio_clock(VideoState *is) {
|
||||||
double pts;
|
double pts;
|
||||||
int hw_buf_size, bytes_per_sec, n;
|
|
||||||
|
|
||||||
pts = is->audio_clock; /* maintained in the audio thread */
|
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) {
|
if(is->audio_st) {
|
||||||
bytes_per_sec = is->audio_st->codec->sample_rate * n;
|
int n = is->audio_st->codec->channels * 2;
|
||||||
}
|
int bytes_per_sec = is->audio_st->codec->sample_rate * n;
|
||||||
if(bytes_per_sec) {
|
int hw_buf_size = is->audio_buf_size - is->audio_buf_index;
|
||||||
pts -= (double)hw_buf_size / bytes_per_sec;
|
pts -= (double)hw_buf_size / bytes_per_sec;
|
||||||
}
|
}
|
||||||
return pts;
|
return pts;
|
||||||
|
|
Loading…
Reference in a new issue