summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2013-01-31 05:23:46 +0000
committerLiong Sauw Ming <ming@teluu.com>2013-01-31 05:23:46 +0000
commitd78fa3a04d0761abf8390da5b5704ef30a66b75d (patch)
tree71fb459cd0566bcd8ae0356e0ab9dc7bbd4955ca
parent7c9af68e60b48c4761b033bf1824872e2c59b907 (diff)
Re #1608: Try to store the number of frames in the packet in case SKP_Silk_SDK_get_TOC() couldn't return the correct number of frames during decode
This was reported to happen in SILK ARM version (thanks to Marcus for the report) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4339 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/src/pjmedia-codec/silk.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/pjmedia/src/pjmedia-codec/silk.c b/pjmedia/src/pjmedia-codec/silk.c
index f2e1df27..3f7bf8f8 100644
--- a/pjmedia/src/pjmedia-codec/silk.c
+++ b/pjmedia/src/pjmedia-codec/silk.c
@@ -771,7 +771,8 @@ static pj_status_t silk_codec_parse( pjmedia_codec *codec,
for (i = 0; i < count; i++) {
frames[i].type = PJMEDIA_FRAME_TYPE_AUDIO;
frames[i].bit_info = (((unsigned)ts->u64 & 0xFFFF) << 16) |
- (((unsigned)pkt & 0xFF) << 8) | i;
+ (((unsigned)pkt & 0xFF) << 8) |
+ (toc.framesInPacket << 4) | i;
frames[i].buf = pkt;
frames[i].size = pkt_size;
frames[i].timestamp.u64 = ts->u64 + i * silk->samples_per_frame;
@@ -801,6 +802,15 @@ static pj_status_t silk_codec_decode(pjmedia_codec *codec,
frm_info = input->bit_info & 0xF;
if (toc.framesInPacket == 0) {
+ /* In SILK ARM version, the table of content can indicate
+ * that the number of frames in the packet is 0.
+ * Try to get the number of frames in packet that we save
+ * in the frame instead.
+ */
+ toc.framesInPacket = (input->bit_info & 0xF0) >> 4;
+ }
+
+ if (toc.framesInPacket == 0) {
output->size = 0;
} else if (silk->pkt_info != pkt_info || input->bit_info == 0) {
unsigned i;