mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
opusenc: avoid potential overflow expression
The result of the two expressions will be promoted to guint64 anyway, perform all the arithmetic in 64 bits to avoid potential overflows. CID 1338690, CID 1338691
This commit is contained in:
parent
dd741e6412
commit
6463ff198e
1 changed files with 3 additions and 2 deletions
|
@ -1007,7 +1007,7 @@ gst_opus_enc_encode (GstOpusEnc * enc, GstBuffer * buf)
|
|||
trim_start = enc->pending_lookahead;
|
||||
enc->pending_lookahead = 0;
|
||||
} else {
|
||||
trim_start = input_samples * 48000 / enc->sample_rate;
|
||||
trim_start = ((guint64) input_samples) * 48000 / enc->sample_rate;
|
||||
enc->pending_lookahead -= trim_start;
|
||||
output_samples = 0;
|
||||
}
|
||||
|
@ -1026,7 +1026,8 @@ gst_opus_enc_encode (GstOpusEnc * enc, GstBuffer * buf)
|
|||
output_samples = enc->consumed_samples - enc->encoded_samples;
|
||||
input_samples = 0;
|
||||
GST_DEBUG_OBJECT (enc, "draining %d samples", output_samples);
|
||||
trim_end = (frame_samples - output_samples) * 48000 / enc->sample_rate;
|
||||
trim_end =
|
||||
((guint64) frame_samples - output_samples) * 48000 / enc->sample_rate;
|
||||
} else if (enc->encoded_samples == enc->consumed_samples) {
|
||||
GST_DEBUG_OBJECT (enc, "nothing to drain");
|
||||
goto done;
|
||||
|
|
Loading…
Reference in a new issue