Skip to content

Commit

Permalink
libobs: Fix warnings
Browse files Browse the repository at this point in the history
Cast away truncation, and widen type before multiplication.
  • Loading branch information
jpark37 authored and jp9000 committed Jul 6, 2021
1 parent ed76a30 commit b94fbac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions libobs/obs-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ static bool ignore_audio(obs_source_t *source, size_t channels,

if (num_floats) {
/* round up the number of samples to drop */
size_t drop = util_mul_div64(start_ts - source->audio_ts - 1,
sample_rate, 1000000000ULL) +
1;
size_t drop =
(size_t)util_mul_div64(start_ts - source->audio_ts - 1,
sample_rate, 1000000000ULL) +
1;
if (drop > num_floats)
drop = num_floats;

Expand Down Expand Up @@ -344,7 +345,7 @@ static void add_audio_buffering(struct obs_core_audio *audio,
AUDIO_OUTPUT_FRAMES);

while (ticks--) {
int cur_ticks = ++audio->buffering_wait_ticks;
const uint64_t cur_ticks = ++audio->buffering_wait_ticks;

new_ts.end = new_ts.start;
new_ts.start =
Expand Down
2 changes: 1 addition & 1 deletion libobs/obs-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ struct obs_core_audio {

uint64_t buffered_ts;
struct circlebuf buffered_timestamps;
int buffering_wait_ticks;
uint64_t buffering_wait_ticks;
int total_buffering_ticks;

float user_volume;
Expand Down

0 comments on commit b94fbac

Please sign in to comment.