summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2010-03-04 15:47:25 +0000
committerNanang Izzuddin <nanang@teluu.com>2010-03-04 15:47:25 +0000
commitac131cb38e62d9b73fc857e270430c0f9ecab27c (patch)
tree075ec44e2b62212c128e4bdd9999e21bc922fb49 /pjmedia
parentc2d852485b8591782c9b371f6b277d4a4d0cd35f (diff)
Ticket #1008:
- Applied VAS AMR playback solution from Forum Nokia. - Fixed AMR playback for VAS and APS in composing DTX/NO_DATA (frame type 15) frame header. - Modified symbsndtest test application to support non-PCM audio. - Minor check fix in pjmedia_codec_mgr_destroy(), caught assertion when VAS factory init failed and media endpoint tried to destroy codec manager (codec mgr hasn't been init-ed). git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3116 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp12
-rw-r--r--pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp37
-rw-r--r--pjmedia/src/pjmedia/codec.c6
3 files changed, 39 insertions, 16 deletions
diff --git a/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp b/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
index b544f9cd..1d818b7e 100644
--- a/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
+++ b/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
@@ -1034,14 +1034,20 @@ static void PlayCb(TAPSCommBuffer &buf, void *user_data)
buf.iBuffer.Append((TUint8*)sf->data, len);
} else {
- buf.iBuffer.Append(0);
+ enum {NO_DATA_FT = 15 };
+ pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+ buf.iBuffer.Append(amr_header);
}
pjmedia_frame_ext_pop_subframes(frame, 1);
} else { /* PJMEDIA_FRAME_TYPE_NONE */
- buf.iBuffer.Append(0);
-
+ enum {NO_DATA_FT = 15 };
+ pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+ buf.iBuffer.Append(amr_header);
+
frame->samples_cnt = 0;
frame->subframe_cnt = 0;
}
diff --git a/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp b/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp
index ae9b43c6..08e36fe9 100644
--- a/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp
+++ b/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp
@@ -415,7 +415,7 @@ TInt CPjAudioEngine::InitRec()
TInt CPjAudioEngine::StartPlay()
{
- TInt err;
+ TInt err = KErrNone;
pj_assert(iVoIPDnlink);
pj_assert(dn_state_ == STATE_READY);
@@ -428,7 +428,6 @@ TInt CPjAudioEngine::StartPlay()
dec_fmt_if;
err = g711dec_if->SetMode((CVoIPFormatIntfc::TG711CodecMode)
setting_.mode);
- pj_assert(err == KErrNone);
}
break;
@@ -438,20 +437,28 @@ TInt CPjAudioEngine::StartPlay()
dec_fmt_if;
err = ilbcdec_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode)
setting_.mode);
- pj_assert(err == KErrNone);
}
break;
+ case EAMR_NB:
+ /* Ticket #1008: AMR playback issue on few devices, e.g: E72, E52 */
+ err = dec_fmt_if->SetFrameMode(ETrue);
+ break;
+
default:
break;
}
+
+ if (err != KErrNone)
+ goto on_return;
/* Configure audio routing */
ActivateSpeaker(setting_.loudspk);
/* Start player */
err = iVoIPDnlink->Start();
-
+
+on_return:
if (err == KErrNone) {
dn_state_ = STATE_STREAMING;
TRACE_((THIS_FILE, "Downlink started"));
@@ -464,7 +471,7 @@ TInt CPjAudioEngine::StartPlay()
TInt CPjAudioEngine::StartRec()
{
- TInt err;
+ TInt err = KErrNone;
pj_assert(iVoIPUplink);
pj_assert(up_state_ == STATE_READY);
@@ -477,7 +484,6 @@ TInt CPjAudioEngine::StartRec()
enc_fmt_if;
err = g711enc_if->SetMode((CVoIPFormatIntfc::TG711CodecMode)
setting_.mode);
- pj_assert(err == KErrNone);
}
break;
@@ -487,24 +493,27 @@ TInt CPjAudioEngine::StartRec()
enc_fmt_if;
err = ilbcenc_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode)
setting_.mode);
- pj_assert(err == KErrNone);
}
break;
case EAMR_NB:
- enc_fmt_if->SetBitRate(setting_.mode);
+ err = enc_fmt_if->SetBitRate(setting_.mode);
break;
default:
break;
}
+ if (err != KErrNone)
+ goto on_return;
+
/* Configure general codec setting */
enc_fmt_if->SetVAD(setting_.vad);
/* Start recorder */
err = iVoIPUplink->Start();
-
+
+on_return:
if (err == KErrNone) {
up_state_ = STATE_STREAMING;
TRACE_((THIS_FILE, "Uplink started"));
@@ -1112,13 +1121,19 @@ static void PlayCb(CVoIPDataBuffer *buf, void *user_data)
buffer.Append((TUint8*)sf->data, len);
} else {
- buffer.Append(0);
+ enum {NO_DATA_FT = 15 };
+ pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+ buffer.Append(amr_header);
}
pjmedia_frame_ext_pop_subframes(frame, 1);
} else { /* PJMEDIA_FRAME_TYPE_NONE */
- buffer.Append(0);
+ enum {NO_DATA_FT = 15 };
+ pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+ buffer.Append(amr_header);
frame->samples_cnt = 0;
frame->subframe_cnt = 0;
diff --git a/pjmedia/src/pjmedia/codec.c b/pjmedia/src/pjmedia/codec.c
index d65ede4e..39d77834 100644
--- a/pjmedia/src/pjmedia/codec.c
+++ b/pjmedia/src/pjmedia/codec.c
@@ -85,10 +85,12 @@ PJ_DEF(pj_status_t) pjmedia_codec_mgr_destroy (pjmedia_codec_mgr *mgr)
}
/* Destroy mutex */
- pj_mutex_destroy(mgr->mutex);
+ if (mgr->mutex)
+ pj_mutex_destroy(mgr->mutex);
/* Release pool */
- pj_pool_release(mgr->pool);
+ if (mgr->pool)
+ pj_pool_release(mgr->pool);
/* Just for safety, set codec manager states to zero */
pj_bzero(mgr, sizeof(pjmedia_codec_mgr));