mirror of https://git.ffmpeg.org/ffmpeg.git
Simplify: Use FFMIN.
This commit is contained in:
parent
621f4c98df
commit
e76c0c6a00
|
@ -179,9 +179,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
uint8_t *buf= pkt->data;
|
uint8_t *buf= pkt->data;
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
len = AUDIO_BLOCK_SIZE - s->buffer_ptr;
|
len = FFMIN(AUDIO_BLOCK_SIZE - s->buffer_ptr, size);
|
||||||
if (len > size)
|
|
||||||
len = size;
|
|
||||||
memcpy(s->buffer + s->buffer_ptr, buf, len);
|
memcpy(s->buffer + s->buffer_ptr, buf, len);
|
||||||
s->buffer_ptr += len;
|
s->buffer_ptr += len;
|
||||||
if (s->buffer_ptr >= AUDIO_BLOCK_SIZE) {
|
if (s->buffer_ptr >= AUDIO_BLOCK_SIZE) {
|
||||||
|
|
|
@ -49,9 +49,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
int len, ret;
|
int len, ret;
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
len = s->buffer_size - s->buffer_offset;
|
len = FFMIN(s->buffer_size - s->buffer_offset, size);
|
||||||
if (len > size)
|
|
||||||
len = size;
|
|
||||||
memcpy(s->buffer + s->buffer_offset, buf, len);
|
memcpy(s->buffer + s->buffer_offset, buf, len);
|
||||||
buf += len;
|
buf += len;
|
||||||
size -= len;
|
size -= len;
|
||||||
|
|
Loading…
Reference in New Issue