summaryrefslogtreecommitdiff
path: root/media/ffvpx/libavutil/samplefmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'media/ffvpx/libavutil/samplefmt.c')
-rw-r--r--media/ffvpx/libavutil/samplefmt.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/media/ffvpx/libavutil/samplefmt.c b/media/ffvpx/libavutil/samplefmt.c
index fc077f6444..6d3ec34dab 100644
--- a/media/ffvpx/libavutil/samplefmt.c
+++ b/media/ffvpx/libavutil/samplefmt.c
@@ -16,11 +16,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "common.h"
+#include "error.h"
+#include "macros.h"
+#include "mem.h"
#include "samplefmt.h"
+#include <limits.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
typedef struct SampleFmtInfo {
@@ -160,13 +162,20 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
if (buf_size < 0)
return buf_size;
+ if (linesize)
+ *linesize = line_size;
+
+ memset(audio_data, 0, planar
+ ? sizeof(*audio_data) * nb_channels
+ : sizeof(*audio_data));
+
+ if (!buf)
+ return buf_size;
+
audio_data[0] = (uint8_t *)buf;
for (ch = 1; planar && ch < nb_channels; ch++)
audio_data[ch] = audio_data[ch-1] + line_size;
- if (linesize)
- *linesize = line_size;
-
return buf_size;
}