repositories
/
deb_ffmpeg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git]
/
ffmpeg
/
libavcodec
/
libspeexdec.c
diff --git
a/ffmpeg/libavcodec/libspeexdec.c
b/ffmpeg/libavcodec/libspeexdec.c
index 5e149a5d5ccaa098d170d264a2d47de34225e728..a5f52d1de6bfe2451888aa950f3613fea3005485 100644
(file)
--- a/
ffmpeg/libavcodec/libspeexdec.c
+++ b/
ffmpeg/libavcodec/libspeexdec.c
@@
-33,6
+33,7
@@
typedef struct {
SpeexStereoState stereo;
void *dec_state;
int frame_size;
SpeexStereoState stereo;
void *dec_state;
int frame_size;
+ int pktsize;
} LibSpeexContext;
} LibSpeexContext;
@@
-50,14
+51,20
@@
static av_cold int libspeex_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
}
if (avctx->codec_tag == MKTAG('S', 'P', 'X', 'N')) {
av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
}
if (avctx->codec_tag == MKTAG('S', 'P', 'X', 'N')) {
+ int quality;
if (!avctx->extradata || avctx->extradata && avctx->extradata_size < 47) {
av_log(avctx, AV_LOG_ERROR, "Missing or invalid extradata.\n");
return AVERROR_INVALIDDATA;
}
if (!avctx->extradata || avctx->extradata && avctx->extradata_size < 47) {
av_log(avctx, AV_LOG_ERROR, "Missing or invalid extradata.\n");
return AVERROR_INVALIDDATA;
}
- if (avctx->extradata[37] != 10) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported quality mode.\n");
+
+ quality = avctx->extradata[37];
+ if (quality > 10) {
+ av_log(avctx, AV_LOG_ERROR, "Unsupported quality mode %d.\n", quality);
return AVERROR_PATCHWELCOME;
}
return AVERROR_PATCHWELCOME;
}
+
+ s->pktsize = ((const int[]){5,10,15,20,20,28,28,38,38,46,62})[quality];
+
spx_mode = 0;
} else if (header) {
avctx->sample_rate = header->rate;
spx_mode = 0;
} else if (header) {
avctx->sample_rate = header->rate;
@@
-143,9
+150,11
@@
static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 0;
return buf_size;
}
*got_frame_ptr = 0;
return buf_size;
}
+ if (s->pktsize && buf_size == 62)
+ buf_size = s->pktsize;
/* set new buffer */
speex_bits_read_from(&s->bits, buf, buf_size);
/* set new buffer */
speex_bits_read_from(&s->bits, buf, buf_size);
- consumed =
buf_
size;
+ consumed =
avpkt->
size;
}
/* decode a single frame */
}
/* decode a single frame */