summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libspeex/speex_header.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-11-01 21:34:15 +0000
committerThom Johansen <thomj@rockbox.org>2007-11-01 21:34:15 +0000
commit80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9 (patch)
tree899b90e2c80053f010f8a6e552c8943d849ced12 /apps/codecs/libspeex/speex_header.c
parentbf1b7f131c933b83afe62f01c200366e4e2e37f3 (diff)
downloadrockbox-80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9.tar.gz
rockbox-80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9.zip
Make Speex read its input directly from the Ogg packet, which makes for less copying and one less malloc(). Thanks to Jean-Marc Valin for the tip.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15395 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/speex_header.c')
-rw-r--r--apps/codecs/libspeex/speex_header.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/codecs/libspeex/speex_header.c b/apps/codecs/libspeex/speex_header.c
index 8fd166576b..1cb25ac2ff 100644
--- a/apps/codecs/libspeex/speex_header.c
+++ b/apps/codecs/libspeex/speex_header.c
@@ -128,10 +128,11 @@ char *speex_header_to_packet(SpeexHeader *header, int *size)
}
#endif
+static SpeexHeader global_le_header; /* Avoid malloc */
SpeexHeader *speex_packet_to_header(char *packet, int size)
{
int i;
- SpeexHeader *le_header;
+ SpeexHeader *le_header = &global_le_header;
const char *h = "Speex ";
for (i=0;i<8;i++)
if (packet[i]!=h[i])
@@ -147,7 +148,7 @@ SpeexHeader *speex_packet_to_header(char *packet, int size)
return NULL;
}
- le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
+ /* le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader)); */
speex_move(le_header, packet, sizeof(SpeexHeader));