Browse Source

oss,sndio: simplify by using FFMIN.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
tags/n0.8
Reimar Döffinger Anton Khirnov 15 years ago
parent
commit
c673c90515
2 changed files with 2 additions and 6 deletions
  1. +1
    -3
      libavdevice/oss_audio.c
  2. +1
    -3
      libavdevice/sndio_enc.c

+ 1
- 3
libavdevice/oss_audio.c View File

@@ -181,9 +181,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
uint8_t *buf= pkt->data;

while (size > 0) {
len = AUDIO_BLOCK_SIZE - s->buffer_ptr;
if (len > size)
len = size;
len = FFMIN(AUDIO_BLOCK_SIZE - s->buffer_ptr, size);
memcpy(s->buffer + s->buffer_ptr, buf, len);
s->buffer_ptr += len;
if (s->buffer_ptr >= AUDIO_BLOCK_SIZE) {


+ 1
- 3
libavdevice/sndio_enc.c View File

@@ -49,9 +49,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
int len, ret;

while (size > 0) {
len = s->buffer_size - s->buffer_offset;
if (len > size)
len = size;
len = FFMIN(s->buffer_size - s->buffer_offset, size);
memcpy(s->buffer + s->buffer_offset, buf, len);
buf += len;
size -= len;


Loading…
Cancel
Save