diff options
-rw-r--r-- | apps/codecs/libspeex/speex_header.c | 5 | ||||
-rw-r--r-- | apps/codecs/speex.c | 11 |
2 files changed, 6 insertions, 10 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) | |||
128 | } | 128 | } |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | static SpeexHeader global_le_header; /* Avoid malloc */ | ||
131 | SpeexHeader *speex_packet_to_header(char *packet, int size) | 132 | SpeexHeader *speex_packet_to_header(char *packet, int size) |
132 | { | 133 | { |
133 | int i; | 134 | int i; |
134 | SpeexHeader *le_header; | 135 | SpeexHeader *le_header = &global_le_header; |
135 | const char *h = "Speex "; | 136 | const char *h = "Speex "; |
136 | for (i=0;i<8;i++) | 137 | for (i=0;i<8;i++) |
137 | if (packet[i]!=h[i]) | 138 | if (packet[i]!=h[i]) |
@@ -147,7 +148,7 @@ SpeexHeader *speex_packet_to_header(char *packet, int size) | |||
147 | return NULL; | 148 | return NULL; |
148 | } | 149 | } |
149 | 150 | ||
150 | le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader)); | 151 | /* le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader)); */ |
151 | 152 | ||
152 | speex_move(le_header, packet, sizeof(SpeexHeader)); | 153 | speex_move(le_header, packet, sizeof(SpeexHeader)); |
153 | 154 | ||
diff --git a/apps/codecs/speex.c b/apps/codecs/speex.c index d26d6f9d83..7edda4b6db 100644 --- a/apps/codecs/speex.c +++ b/apps/codecs/speex.c | |||
@@ -364,7 +364,6 @@ static void *process_header(spx_ogg_packet *op, | |||
364 | 364 | ||
365 | *extra_headers = header->extra_headers; | 365 | *extra_headers = header->extra_headers; |
366 | 366 | ||
367 | codec_free(header); | ||
368 | return st; | 367 | return st; |
369 | } | 368 | } |
370 | 369 | ||
@@ -413,8 +412,6 @@ next_track: | |||
413 | samplerate = ci->id3->frequency; | 412 | samplerate = ci->id3->frequency; |
414 | codec_set_replaygain(ci->id3); | 413 | codec_set_replaygain(ci->id3); |
415 | 414 | ||
416 | speex_bits_init(&bits); | ||
417 | |||
418 | eof = 0; | 415 | eof = 0; |
419 | while (!eof) { | 416 | while (!eof) { |
420 | ci->yield(); | 417 | ci->yield(); |
@@ -513,10 +510,9 @@ next_page: | |||
513 | if (op.e_o_s) /* End of stream condition */ | 510 | if (op.e_o_s) /* End of stream condition */ |
514 | eos=1; | 511 | eos=1; |
515 | 512 | ||
516 | /* Copy Ogg packet to Speex bitstream */ | 513 | /* Set Speex bitstream to point to Ogg packet */ |
517 | 514 | speex_bits_set_bit_buffer(&bits, (char *)op.packet, | |
518 | speex_bits_read_from(&bits, (char*)op.packet, op.bytes); | 515 | op.bytes); |
519 | |||
520 | for (j = 0; j != nframes; j++){ | 516 | for (j = 0; j != nframes; j++){ |
521 | int ret; | 517 | int ret; |
522 | 518 | ||
@@ -561,7 +557,6 @@ done: | |||
561 | /* Clean things up for the next track */ | 557 | /* Clean things up for the next track */ |
562 | 558 | ||
563 | speex_decoder_destroy(st); | 559 | speex_decoder_destroy(st); |
564 | speex_bits_reset(&bits); | ||
565 | 560 | ||
566 | if (stream_init == 1) | 561 | if (stream_init == 1) |
567 | spx_ogg_stream_reset(&os); | 562 | spx_ogg_stream_reset(&os); |