summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-26 16:50:48 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-26 16:50:48 +0100
commitaaa8c31e4cdfb0921b40feef4da6fdcb36d0783f (patch)
tree9daa9a689bcf5eff00d9e094c8950ffd7ece25ab /plugins
parent83ca87172340b201e57f680c0a16a9ecdb5f0e0f (diff)
moved ffmpeg buffer memory from BSS to heap
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ffmpeg/ffmpeg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 98db64d6..a3aed271 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -58,7 +58,7 @@ static int stream_id;
static int left_in_packet;
static int have_packet;
-static char buffer[AVCODEC_MAX_AUDIO_FRAME_SIZE];
+static char *buffer; // must be AVCODEC_MAX_AUDIO_FRAME_SIZE
static int left_in_buffer;
static int
@@ -128,6 +128,11 @@ ffmpeg_init (DB_playItem_t *it) {
memset (&pkt, 0, sizeof (pkt));
have_packet = 0;
+ buffer = malloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
+ if (!buffer) {
+ fprintf (stderr, "ffmpeg: failed to allocate buffer memory\n");
+ return -1;
+ }
// fill in mandatory plugin fields
plugin.info.readpos = 0;
plugin.info.bps = bps;
@@ -138,6 +143,10 @@ ffmpeg_init (DB_playItem_t *it) {
static void
ffmpeg_free (void) {
+ if (buffer) {
+ free (buffer);
+ buffer = NULL;
+ }
// free everything allocated in _init and _read_int16
if (have_packet) {
av_free_packet (&pkt);