[FFmpeg-cvslog] oss,sndio: simplify by using FFMIN.

Reimar Döffinger git at videolan.org
Fri Jun 10 04:53:07 CEST 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Tue Mar 29 20:18:45 2011 +0200| [c673c90515ab553c9ed9f4e1997600d1b3e4e2bb] | committer: Anton Khirnov

oss,sndio: simplify by using FFMIN.

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c673c90515ab553c9ed9f4e1997600d1b3e4e2bb
---

 libavdevice/oss_audio.c |    4 +---
 libavdevice/sndio_enc.c |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index af46ea8..fcbe26b 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -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) {
diff --git a/libavdevice/sndio_enc.c b/libavdevice/sndio_enc.c
index 6745ba4..49a52b3 100644
--- a/libavdevice/sndio_enc.c
+++ b/libavdevice/sndio_enc.c
@@ -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;



More information about the ffmpeg-cvslog mailing list