summaryrefslogtreecommitdiff
path: root/libavdevice/alsa-audio-enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavdevice/alsa-audio-enc.c')
-rw-r--r--libavdevice/alsa-audio-enc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c
index ebe598c86f..0bc53b6f54 100644
--- a/libavdevice/alsa-audio-enc.c
+++ b/libavdevice/alsa-audio-enc.c
@@ -3,20 +3,20 @@
* Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
* Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -76,7 +76,15 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
int size = pkt->size;
uint8_t *buf = pkt->data;
- while((res = snd_pcm_writei(s->h, buf, size / s->frame_size)) < 0) {
+ size /= s->frame_size;
+ if (s->reorder_func) {
+ if (size > s->reorder_buf_size)
+ if (ff_alsa_extend_reorder_buf(s, size))
+ return AVERROR(ENOMEM);
+ s->reorder_func(buf, s->reorder_buf, size);
+ buf = s->reorder_buf;
+ }
+ while ((res = snd_pcm_writei(s->h, buf, size)) < 0) {
if (res == -EAGAIN) {
return AVERROR(EAGAIN);