static const uint16 AMR_JITTER = 80; // maximum jitter allocated in timestamps
static const uint16 AMR_QUEUE_SIZE = 5; // number of frames used to smoothen timestamps
static const uint16 AMR_SID_SIZE = 6; // amr SID_UPDATE frame size in bytes
+static const uint16 AMR_SID_UPDATE = 8; // sid update should happen in every 8 frame (3GPP TS 26.093)
+static const uint16 AMR_NODATA_SIZE = 1; // amr SID_UPDATE frame size in bytes
+static const uint32 AMR_TIMER_FREQUENCY = AMR_FRAME_SIZE_MS * AMR_SID_UPDATE * 1000; // dtx timer frequency in microseconds
+static const int32 AMR_TIMER_ID = 0; // dtx timer id
+static const uint8 AMR_NO_DATA = 15; // NO_DATA frame type
#ifdef LIP_SYNC_TESTING
/***********************Outgoing side********************/
PVMFStatus H223LogicalChannel::SetFormatSpecificInfo(uint8* info, uint32 info_len)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel::SetFormatSpecificInfo lcn=%d, info_len=%d, info=%x", lcn, info_len, info));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel(%d)::SetFormatSpecificInfo info_len=%d, info=%x", lcn, info_len, info));
if (iFormatSpecificInfo)
{
oscl_free(iFormatSpecificInfo);
{
if (info_len == NULL)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel::GetFormatSpecificInfo ERROR info_len==NULL"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel(%d)::GetFormatSpecificInfo ERROR info_len==NULL", lcn));
return NULL;
}
*info_len = iFormatSpecificInfoLen;
void H223LogicalChannel::Pause()
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Pause lcn=%d", lcn));
+ if (iPaused)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel(d%)::Pause - Already paused", lcn));
+ return;
+ }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel(d%)::Pause", lcn));
+
iPaused = true;
// flush any pending media data
Flush();
+
}
void H223LogicalChannel::Resume()
iOutgoingVideoLogger = PVLogger::GetLoggerObject("datapath.outgoing.video.h223.lcn");
iOutgoingAudioLogger = PVLogger::GetLoggerObject("datapath.outgoing.audio.h223.lcn");
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::H223OutgoingChannel - num(%d),segmentable(%d)", num, segmentable));
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::H223OutgoingChannel - AL SDU size(%d), hdr(%d), trlr(%d)", iAl->GetSduSize(), iAl->GetHdrSz(), iAl->GetTrlrSz()));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::H223OutgoingChannel(%d) - num(%d),segmentable(%d)", lcn , num, segmentable));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::H223OutgoingChannel(%d) - AL SDU size(%d), hdr(%d), trlr(%d)", lcn , iAl->GetSduSize(), iAl->GetHdrSz(), iAl->GetTrlrSz()));
ResetStats();
lastMediaData = NULL;
{
if (iBufferSizeMs && aMs > iBufferSizeMs)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::BufferMedia ERROR buffer interval=%d > buffer size=%d", aMs, iBufferSizeMs));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::BufferMedia ERROR buffer interval=%d > buffer size=%d", lcn , aMs, iBufferSizeMs));
}
iSetBufferMediaMs = iBufferMediaMs = aMs;
iSetBufferMediaBytes = iBufferMediaBytes = ((iBufferSizeMs * iBitrate + 4000) / 8000);
- //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223OutgoingChannel::BufferMedia ms=%d,bytes=%d", iBufferMediaMs,iBufferMediaBytes));
+ //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223OutgoingChannel(%d)::BufferMedia ms=%d,bytes=%d",lcn, iBufferMediaMs,iBufferMediaBytes));
}
void H223OutgoingChannel::Resume()
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Resume lcn=%d", lcn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::Resume", lcn));
H223LogicalChannel::Resume();
iPaused = false;
// start muxing on a random access point
void H223OutgoingChannel::SetBufferSizeMs(uint32 buffer_size_ms)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingLogicalChannel::SetBufferSizeMs buffer_size_ms=%d", buffer_size_ms));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingLogicalChannel(%d)::SetBufferSizeMs buffer_size_ms=%d", lcn, buffer_size_ms));
iBufferSizeMs = buffer_size_ms;
}
TimeValue timenow;
if (iMediaType.isCompressed() && iMediaType.isAudio())
{
- PVMF_OUTGOING_AUDIO_LOGDATATRAFFIC((0, "Outgoing audio frames received. Stats: Entry time=%ud, lcn=%d, size=%d", timenow.to_msec(), lcn, mediaData->getFilledSize()));
+ PVMF_OUTGOING_AUDIO_LOGDATATRAFFIC((0, "Outgoing audio frames received. Stats: Entry time=%u, ts=%u, lcn=%d, size=%d", timenow.to_msec(), mediaData->getTimestamp(), lcn, mediaData->getFilledSize()));
}
else if (iMediaType.isCompressed() && iMediaType.isVideo())
{
- PVMF_OUTGOING_VIDEO_LOGDATATRAFFIC((0, "Outgoing video frames received.Stats: Entry time=%ud, lcn=%d, size=%d", timenow.to_msec(), lcn, mediaData->getFilledSize()));
- }
-
- if (iNumPacketsIn % 20 == 0)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData lcn=%d, size=%d, ts=%d", lcn, mediaData->getFilledSize(), mediaData->getTimestamp()));
+ PVMF_OUTGOING_VIDEO_LOGDATATRAFFIC((0, "Outgoing video frames received.Stats: Entry time=%u, ts=%u, lcn=%d, size=%d", timenow.to_msec(), mediaData->getTimestamp(), lcn, mediaData->getFilledSize()));
}
// Check for FSI so that it can be send with data
if (mediaData->getFormatSpecificInfo(iFsiFrag) && iFsiFrag.getMemFragPtr() && iFsiFrag.getMemFragSize())
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData Received Format Specific Info, len=%d", iFsiFrag.getMemFragSize()));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData Received Format Specific Info, len=%d", lcn, iFsiFrag.getMemFragSize()));
PVLOGGER_LOG_USE_ONLY(
TestFsi(iFsiFrag);
{
if ((mediaData->getMarkerInfo()&PVMF_MEDIA_DATA_MARKER_INFO_RANDOM_ACCESS_POINT_BIT) == 0)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData Not random access point. Dropping media data."));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData Not random access point. Dropping media data.", lcn));
return PVMFErrInvalidState;
}
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData Found random access point."));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData Found random access point.", lcn));
iWaitForRandomAccessPoint = false;
}
else if (iNumPendingPdus == (iNumMediaData - 1))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - ERROR Overflow, iNumPendingPdus=%u", iNumPendingPdus));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData - ERROR Overflow, iNumPendingPdus=%u", lcn, iNumPendingPdus));
return PVMFErrOverflow;
}
if ((mediaData->getNumFragments() + num_frags_required + iNumPendingPdus) >= (iNumMediaData - 1))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - ERROR Overflow, iNumPendingPdus=%u, num_frags_required=%d,iNumMediaData=%d", iNumPendingPdus, num_frags_required, iNumMediaData));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData - ERROR Overflow, iNumPendingPdus=%u, num_frags_required=%d,iNumMediaData=%d", lcn, iNumPendingPdus, num_frags_required, iNumMediaData));
Flush();
/* Start re-buffering */
BufferMedia((uint16)iSetBufferMediaMs);
{
if (true != FragmentPacket(mediaData, fragmentedMediaData))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - Memory allocation failure on Fragment\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData - Memory allocation failure on Fragment\n", lcn));
return PVMFErrOverflow;
}
}
{
if (PVMFSuccess != CompletePdu())
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - Memory allocation failure on CompletePdu\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData - Memory allocation failure on CompletePdu\n", lcn));
return PVMFErrOverflow;
}
if (iMediaType.isCompressed() && iMediaType.isAudio())
}
if (sdu_size == 0)
{
- //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223OutgoingChannel::PutData Sdu size == 0"));
+ //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223OutgoingChannel(%d)::PutData Sdu size == 0", lcn));
iCurPdu = StartAlPdu();
if (!iCurPdu)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "H223OutgoingChannel::PutData - Memory allocation failure on StartAlPdu\n"));
+ (0, "H223OutgoingChannel(%d)::PutData - Memory allocation failure on StartAlPdu\n", lcn));
return PVMFErrOverflow;
}
{
if (PVMFSuccess != CompletePdu())
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - Memory allocation failure on CompletePdu\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PutData - Memory allocation failure on CompletePdu\n", lcn));
return PVMFErrOverflow;
}
if (iMediaType.isCompressed() && iMediaType.isAudio())
if (!iCurPdu)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "H223OutgoingChannel::PutData - Memory allocation failure on StartAlPdu\n"));
+ (0, "H223OutgoingChannel(%d)::PutData - Memory allocation failure on StartAlPdu\n", lcn));
return PVMFErrOverflow;
}
}
PVMFStatus status = iAl->CompletePacket(iCurPdu);
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::CompletePdu Memory allocation failedlcn=%d, CompletePacket status=%d", lcn, status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::CompletePdu Memory allocation failed, CompletePacket status=%d", lcn, status));
return status;
}
return PVMFErrNoMemory;
}
- OsclRefCounterMemFrag frag;
- mediaData->getFormatSpecificInfo(frag);
-
mediaData->setTimestamp(timestamp);
if (fsi)
{
/* Adjust buffering parameters */
if (iBufferMediaMs)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::AppendOutgoingPkt lcn=%d, last ts=%d,cur ts=%d", lcn, lastTS, timestamp));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::AppendOutgoingPkt last ts=%d,cur ts=%d", lcn, lastTS, timestamp));
/* Compute delta_t from last media data */
int32 delta_t = timestamp - lastTS;
if (delta_t < 0)
}
if ((aStatus == PVMFSuccess) && iPaused)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::GetNextPacket Logical channel %d paused.", lcn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::GetNextPacket Logical channel paused.", lcn));
return false;
}
if ((aStatus == PVMFSuccess) && iBufferMediaMs && iBufferMediaBytes)
{
/* Still buffering */
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::GetNextPacket Buffering lcn=%d, ms left=%d", lcn, iBufferMediaMs));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::GetNextPacket Buffering ms left=%d", lcn, iBufferMediaMs));
return false;
}
OsclAny H223OutgoingChannel::Flush()
{
- //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223OutgoingChannel::Flush\n"));
+ //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223OutgoingChannel(%d)::Flush\n", lcn));
PVMFSharedMediaDataPtr aMediaData;
OSCL_EXPORT_REF PVMFStatus H223OutgoingChannel::Connect(PVMFPortInterface* aPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Connect, aPort=%x", aPort));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::Connect, aPort=%x", lcn, aPort));
if (iConnectedPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Connect Error: Already connected"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::Connect Error: Already connected", lcn));
return PVMFFailure;
}
config = OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, tempInterface);
if (!config)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Connect: Error - Peer port does not support capability interface"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::Connect: Error - Peer port does not support capability interface", lcn));
return PVMFFailure;
}
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Connect: Error - Settings negotiation failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::Connect: Error - Settings negotiation failed. status=%d", lcn, status));
return status;
}
//Automatically connect the peer.
if ((status = aPort->PeerConnect(this)) != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::Connect: Error - Peer Connect failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::Connect: Error - Peer Connect failed. status=%d", lcn, status));
return status;
}
OSCL_EXPORT_REF PVMFStatus H223OutgoingChannel::PeerConnect(PVMFPortInterface* aPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PeerConnect aPort=0x%x", this, aPort));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::PeerConnect aPort=0x%x", lcn, this, aPort));
if (!aPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingChannel::PeerConnect: Error - Connecting to invalid port", this));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingChannel(%d)::PeerConnect: Error - Connecting to invalid port", lcn, this));
return PVMFErrArgument;
}
if (iConnectedPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingChannel::PeerConnect: Error - Already connected", this));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingChannel(%d)::PeerConnect: Error - Already connected", lcn, this));
return PVMFFailure;
}
aPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, config);
if (!config)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::PeerConnect: Error - Peer port does not support capability interface"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel(%d)::PeerConnect: Error - Peer port does not support capability interface", lcn));
return PVMFFailure;
}
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::PeerConnect: Error - Settings negotiation failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel(%d)::PeerConnect: Error - Settings negotiation failed. status=%d", lcn, status));
// Ignore errors for now
status = PVMFSuccess;
}
PVMFStatus H223OutgoingChannel::NegotiateInputSettings(PvmiCapabilityAndConfig* aConfig)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::NegotiateInputSettings, aConfig=%x", aConfig));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::NegotiateInputSettings, aConfig=%x", lcn, aConfig));
PvmiKvp* kvp = NULL;
int numParams = 0;
kvp, numParams, NULL);
if (status != PVMFSuccess || numParams == 0)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::NegotiateInputSettings, Error: getParametersSync failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel(%d)::NegotiateInputSettings, Error: getParametersSync failed. status=%d", lcn, status));
return status;
}
if (!selectedKvp)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::NegotiateInputSettings, Error: Input format not supported by peer"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel(%d)::NegotiateInputSettings, Error: Input format not supported by peer", lcn));
return PVMFFailure;
}
if (PVMFSuccess != setConfigParametersSync(selectedKvp, aConfig))
int& num_parameter_elements,
PvmiCapabilityContext context)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::getParametersSync"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::getParametersSync", lcn));
OSCL_UNUSED_ARG(session);
OSCL_UNUSED_ARG(context);
num_parameter_elements);
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::getParametersSync: Error - AllocateKvp failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::getParametersSync: Error - AllocateKvp failed. status=%d", lcn, status));
return status;
}
PVCodecType_t codec_type = GetCodecType(iDataType);
status = VerifyAndSetParameter(&(parameters[i]), true);
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::setParametersSync: Error - VerifiyAndSetParameter failed on parameter #%d", i));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::setParametersSync: Error - VerifiyAndSetParameter failed on parameter #%d", lcn, i));
ret_kvp = &(parameters[i]);
OSCL_LEAVE(OsclErrArgument);
}
PVMFStatus H223OutgoingChannel::VerifyAndSetParameter(PvmiKvp* aKvp, bool aSetParam)
{
OSCL_UNUSED_ARG(aSetParam);
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::VerifyAndSetParameter: aKvp=0x%x, aSetParam=%d", aKvp, aSetParam));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::VerifyAndSetParameter: aKvp=0x%x, aSetParam=%d", lcn, aKvp, aSetParam));
if (!aKvp)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::VerifyAndSetParameter: Error - Invalid key-value pair"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::VerifyAndSetParameter: Error - Invalid key-value pair", lcn));
return PVMFFailure;
}
if (iDataType == NULL)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::VerifyAndSetParameter: Error - DataType == NULL"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::VerifyAndSetParameter: Error - DataType == NULL", lcn));
return PVMFErrNotSupported;
}
PVMFFormatType lcn_format_type = PVCodecTypeToPVMFFormatType(codec_type);
if (pv_mime_strcmp(lcn_format_type.getMIMEStrPtr(), aKvp->value.pChar_value) != 0)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::VerifyAndSetParameter: Error - Input format %s not supported", aKvp->value.pChar_value));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::VerifyAndSetParameter: Error - Input format %s not supported", lcn, aKvp->value.pChar_value));
return PVMFErrNotSupported;
}
}
void H223OutgoingChannel::HandlePortActivity(const PVMFPortActivity &aActivity)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::HandlePortActivity(%d) lcn(%d)", aActivity.iType, lcn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::HandlePortActivity(%d)", lcn, aActivity.iType));
switch (aActivity.iType)
{
case PVMF_PORT_ACTIVITY_CREATED:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity created"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity created", lcn));
return;
case PVMF_PORT_ACTIVITY_DELETED:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity deleted"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity deleted", lcn));
return;
case PVMF_PORT_ACTIVITY_CONNECT:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity connect"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity connect", lcn));
return;
case PVMF_PORT_ACTIVITY_DISCONNECT:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity disconnect"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity disconnect", lcn));
return;
case PVMF_PORT_ACTIVITY_OUTGOING_MSG:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity outgoing msg"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity outgoing msg", lcn));
return;
case PVMF_PORT_ACTIVITY_INCOMING_MSG:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity incoming msg"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity incoming msg", lcn));
break;
case PVMF_PORT_ACTIVITY_OUTGOING_QUEUE_BUSY:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity outgoing queue busy"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity outgoing queue busy", lcn));
return;
case PVMF_PORT_ACTIVITY_OUTGOING_QUEUE_READY:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity outgoing queue ready"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity outgoing queue ready", lcn));
return;
case PVMF_PORT_ACTIVITY_CONNECTED_PORT_BUSY:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity connected port busy"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity connected port busy", lcn));
return;
case PVMF_PORT_ACTIVITY_CONNECTED_PORT_READY:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity connected port ready"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel(%d)::HandlePortActivity connected port ready", lcn));
break;
case PVMF_PORT_ACTIVITY_ERROR:
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::HandlePortActivity error"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel(%d)::HandlePortActivity error", lcn));
return;
}
}
else
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel::HandlePortActivity Failed to DeQueue incoming message: %d", aStatus));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223OutgoingChannel(%d)::HandlePortActivity Failed to DeQueue incoming message: %d", lcn, aStatus));
break;
}
}
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::HandlePortActivity - out"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::HandlePortActivity - out", lcn));
}
PVLOGGER_LOG_USE_ONLY(
uint8* pMemFrag = OSCL_STATIC_CAST(uint8*, aMemFrag.getMemFragPtr());
- uint16 compSize = OSCL_MIN(fsiLen - iFsiTestIndex, memFragSize);
+ uint16 compSize = OSCL_STATIC_CAST(uint16, OSCL_MIN(fsiLen - iFsiTestIndex, memFragSize));
// compare and print result if error found
if (fsiLen && oscl_memcmp(pMemFrag, &pFsi[iFsiTestIndex], compSize))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::TestFsi Format Specific Info conflict"));
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::TestFsi FSI BS"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel(%d)::TestFsi Format Specific Info conflict", lcn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::TestFsi FSI BS", lcn));
for (int ii = 0; ii < compSize; ii++)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::TestFsi %#x %#x", pFsi[iFsiTestIndex + ii], pMemFrag[ii]));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::TestFsi %#x %#x", lcn, pFsi[iFsiTestIndex + ii], pMemFrag[ii]));
}
}
OSCL_EXPORT_REF PVMFStatus H223OutgoingControlChannel::PeerConnect(PVMFPortInterface* aPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel::PeerConnect aPort=0x%x", this, aPort));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel(%d)::PeerConnect aPort=0x%x", lcn, this, aPort));
if (!aPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingControlChannel::PeerConnect: Error - Connecting to invalid port", this));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingControlChannel(%d)::PeerConnect: Error - Connecting to invalid port", lcn, this));
return PVMFErrArgument;
}
if (iConnectedPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingControlChannel::PeerConnect: Error - Already connected", this));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "0x%x H223OutgoingControlChannel(%d)::PeerConnect: Error - Already connected", lcn, this));
return PVMFFailure;
}
}
PVMFStatus H223OutgoingControlChannel::PutData(PVMFSharedMediaMsgPtr aMsg)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel::PutData - iNumPendingPdus=%u,iNumMediaData=%u\n", iNumPendingPdus, iNumMediaData));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel(%d)::PutData - iNumPendingPdus=%u,iNumMediaData=%u\n", lcn, iNumPendingPdus, iNumMediaData));
PVMFSharedMediaDataPtr mediaData;
convertToPVMFMediaData(mediaData, aMsg);
if (!pdu)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel::PutData - Memory allocation failure on iMediaFragGroupAlloc->allocate\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel(%d)::PutData - Memory allocation failure on iMediaFragGroupAlloc->allocate\n", lcn));
return PVMFErrNoMemory;
}
PVMFStatus status = iAl->CompletePacket(pdu);
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel::PutData - Memory allocation failure on iAl->CompletePacket()"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel(%d)::PutData - Memory allocation failure on iAl->CompletePacket()", lcn));
return status;
}
// Add it to the outgoing queue
if (PVMFSuccess != AppendOutgoingPkt(pdu, timenow.to_msec(), (fsi_available ? &fsi : NULL)))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel::PutData - Memory allocation failure on AppendOutgoingPkt()"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingControlChannel(%d)::PutData - Memory allocation failure on AppendOutgoingPkt()", lcn));
return PVMFErrNoMemory;
}
return PVMFSuccess;
}
-void H223LogicalChannel::SetDatapathLatency(uint32 aLatency)
-{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel::SetDatapathLatency lcn=%d, aLatency=%d", lcn, aLatency));
- iDatapathLatency = aLatency;
-}
-
PVMFStatus H223LogicalChannel::setConfigParametersSync(PvmiKvp* selectedKvp,
PvmiCapabilityAndConfig* aConfig,
PVMFFormatType lcn_format_type,
{
OSCL_TRY(err, aConfig->setParametersSync(NULL, selectedKvp, 1, retKvp););
OSCL_FIRST_CATCH_ANY(err,
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::setConfigParametersSync, Error: setParametersSync failed, err=%d", err));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel(%d)::setConfigParametersSync, Error: setParametersSync failed, err=%d", lcn, err));
return PVMFFailure;
);
}
OSCL_TRY(err, aConfig->setParametersSync(NULL, selectedKvp, 1, retKvp););
if (err)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::setConfigParametersSync, Error: setParametersSync failed for pChar value, trying uint32, err=%d", err));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::setConfigParametersSync, Error: setParametersSync failed for pChar value, trying uint32, err=%d", lcn, err));
selectedKvp->value.pChar_value = OSCL_STATIC_CAST(mbchar*, lcn_format_type.getMIMEStrPtr());
err = 0;
OSCL_TRY(err, aConfig->setParametersSync(NULL, selectedKvp, 1, retKvp););
if (err)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::setConfigParametersSync, Error: setParametersSync failed, err=%d", err));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::setConfigParametersSync, Error: setParametersSync failed, err=%d", lcn, err));
return PVMFFailure;
}
}
iMediaDataAlloc(&iMemAlloc),
iPduSize(al->GetPduSize()),
iCurPduSize(0),
- iRenderingSkew(0),
iVideoFrameNum(0),
iMax_Chunk_Size(0),
ipVideoFrameReszMemPool(NULL),
ipVideoFrameAlloc(NULL),
ipVideoDataMemPool(NULL),
iLastAudioTS(0),
- iAudioFrameNum(0)
+ iAudioFrameNum(0),
+ ipAudioDtxTimer(NULL),
+ iBosMessageSent(false)
{
#ifdef LIP_SYNC_TESTING
iParam = ShareParams::Instance();
H223IncomingChannel::~H223IncomingChannel()
{
+ // clean audio dtx timer
+ if (ipAudioDtxTimer)
+ {
+ ipAudioDtxTimer->Cancel(AMR_TIMER_ID);
+ ipAudioDtxTimer->Clear();
+ OSCL_DELETE(ipAudioDtxTimer);
+ }
+
iAudioDataQueue.clear();
Flush();
void H223IncomingChannel::Init()
{
OsclSharedPtr<PVMFMediaDataImpl> tempImpl;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Init"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Init", lcn));
H223LogicalChannel::Init();
int bitrate = (GetBitrate() > 0) ? GetBitrate() : DEF_CHANNEL_BITRATE;
tempImpl = ipVideoFrameAlloc->allocate(MAX_VIDEO_FRAME_PARSE_SIZE);
if (!tempImpl)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::Init(), tempImpl Allocation failed\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::Init(), tempImpl Allocation failed\n", lcn));
OSCL_LEAVE(PVMFErrNoMemory);
}
OSCL_LEAVE(PVMFErrNoMemory);
}
}
+ else if (iMediaType.isAudio())
+ {
+ PVMFStatus err = PVMFNotSet;
+ typedef OsclTimer<OsclMemAllocator> timerType;
+ OSCL_TRY(err, ipAudioDtxTimer = OSCL_NEW(timerType, ("IncomingChannelDTXTimer")););
+ // only log the error, we can do without the timer if
+ OSCL_FIRST_CATCH_ANY(err,
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel(%d)::Init(), Error: IncomingChannelDTXTimer allocation failed, err=%d", lcn, err));
+ );
+ if (ipAudioDtxTimer)
+ {
+ ipAudioDtxTimer->SetExactFrequency(AMR_TIMER_FREQUENCY);
+ ipAudioDtxTimer->SetObserver(this);
+ }
+ }
ResetAlPdu();
AllocateAlPdu();
PVLOGGER_LOG_USE_ONLY(
if (iAlPduMediaData->getFilledSize() > iPduSize)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::CopyToCurrentFrag WARNING current pdu size=%d > iPduSize=%d", iAlPduMediaData->getFilledSize(), iPduSize));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::CopyToCurrentFrag WARNING current pdu size=%d > iPduSize=%d", lcn, iAlPduMediaData->getFilledSize(), iPduSize));
}
);
return num_bytes_copied;
{
if (iPaused)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::PreAlPduData Logical channel paused. Dropping media data."));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::PreAlPduData Logical channel paused. Dropping media data.", lcn));
return;
}
}
if (iAlPduMediaData.GetRep() == NULL || iAlPduMediaData->getFilledSize() == 0)
{
- bool overflow = false;
- if (lcn != 0 && iClock)
+ if (lcn != 0)
{
- // not the control channel
- iClock->GetCurrentTime32(iCurTimestamp, overflow, PVMF_MEDIA_CLOCK_MSEC);
+ UpdateCurrentTimestamp();
}
}
uint32 copied = CopyAlPduData(buf, len);
PVMFStatus H223IncomingChannel::AlDispatch()
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::AlDispatch lcn=%d, iCurPduSize=%d, sn=%d", lcn, iCurPduSize, iNumSdusIn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::AlDispatch, iCurPduSize=%d, sn=%d", lcn, iCurPduSize, iNumSdusIn));
IncomingALPduInfo info;
if (iPaused)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::AlDispatch Logical channel paused."));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::AlDispatch Logical channel paused.", lcn));
return PVMFFailure;
}
/* Nothing to dispatch */
if (!iAlPduMediaData.GetRep())
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::AlDispatch Nothing to dispatch."));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::AlDispatch Nothing to dispatch.", lcn));
ResetAlPdu();
return PVMFSuccess;
}
int32 len = info.sdu_size;
if (len <= 0)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::AlDispatch Empty SDU lcn=%d, len=%d", lcn, len));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::AlDispatch Empty SDU len=%d", lcn, len));
ResetAlPdu();
return PVMFErrCorrupt;
}
if (info.crc_error)
{
errorsFlag |= PVMF_MEDIA_DATA_BIT_ERRORS;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::AlDispatch CRC error lcn=%d, size=%d", lcn, len));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::AlDispatch CRC error size=%d", lcn, len));
status = PVMFErrCorrupt;
}
else
if (info.seq_num_error)
{
errorsFlag |= PVMF_MEDIA_DATA_PACKET_LOSS;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::AlDispatch Sequence number error lcn=%d, size=%d", lcn, len));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::AlDispatch Sequence number error size=%d", lcn, len));
status = PVMFErrCorrupt;
}
return PVMFErrNoMemory;
}
-
- PVMFTimestamp baseTimestamp = 0;
- SetSampleTimestamps(baseTimestamp);
- aMediaData->setTimestamp(baseTimestamp);
+ aMediaData->setTimestamp(iCurTimestamp);
aMediaData->setSeqNum(info.seq_num);
iAlPduMediaData->setErrorsFlag(errorsFlag);
status = DispatchOutgoingMsg(aMediaData);
OsclAny H223IncomingChannel::Flush()
{
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Flush()", lcn));
+
PV_STAT_INCR(iNumBytesFlushed, (iAlPduFragPos - (uint8*)iAlPduFrag.getMemFragPtr()))
PV_STAT_INCR_COND(iNumAbort, 1, (iAlPduFragPos - (uint8*)iAlPduFrag.getMemFragPtr()))
iVideoFrame.Unbind();
ResetAlPdu();
-
+ iAudioDataQueue.clear();
}
PVMFStatus H223IncomingChannel::Connect(PVMFPortInterface* aPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Connect lcn(%d)\n", lcn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Connect", lcn));
if (iConnectedPort)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Connect Error: Already connected"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Connect Error: Already connected", lcn));
return PVMFFailure;
}
config = OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, tempInterface);
if (!config)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Connect: Error - Peer port does not support capability interface"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Connect: Error - Peer port does not support capability interface", lcn));
return PVMFFailure;
}
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Connect: Error - Settings negotiation failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Connect: Error - Settings negotiation failed. status=%d", lcn, status));
return status;
}
if (!(pvmiSetPortFormatSpecificInfoSync(OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, config), PVMF_FORMAT_SPECIFIC_INFO_KEY)))
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_MLDBG, iLogger, PVLOGMSG_INFO
- , (0, "H223IncomingChannel::Connect: Error - Unable To Send Format Specific Info To Peer"));
+ , (0, "H223IncomingChannel(%d)::Connect: Error - Unable To Send Format Specific Info To Peer", lcn));
return PVMFFailure;
}
}
//Automatically connect the peer.
if ((status = aPort->PeerConnect(this)) != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Connect: Error - Peer Connect failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Connect: Error - Peer Connect failed. status=%d", lcn, status));
return status;
}
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::Connect: Failed to send BOS message status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::Connect: Failed to send BOS message status=%d", lcn, status));
return status;
}
return PVMFSuccess;
}
+void H223IncomingChannel::Pause()
+{
+ if (iPaused)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel(%d)::Pause - Already paused", lcn));
+ return;
+ }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel(%d)::Pause", lcn));
+ H223LogicalChannel::Pause();
+ iBosMessageSent = false;
+}
+
+void H223IncomingChannel::Resume()
+{
+ if (!iPaused)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel(%d)::Resume - Already resumed", lcn));
+ }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel(%d)::Resume", lcn));
+ H223LogicalChannel::Resume();
+ SendBeginOfStreamMediaCommand();
+}
+
OsclAny H223IncomingChannel::ResetStats()
{
iNumSdusIn = 0;
}
PVMFStatus H223IncomingChannel::NegotiateOutputSettings(PvmiCapabilityAndConfig* aConfig)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::NegotiateInputSettings, aConfig=%x", aConfig));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::NegotiateInputSettings, aConfig=%x", lcn, aConfig));
PvmiKvp* kvp = NULL;
int numParams = 0;
if (status != PVMFSuccess || numParams == 0)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::NegotiateInputSettings, Error: getParametersSync failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::NegotiateInputSettings, Error: getParametersSync failed. status=%d", lcn, status));
return PVMFSuccess;
}
if (!selectedKvp)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::NegotiateInputSettings, Error: Input format not supported by peer"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::NegotiateInputSettings, Error: Input format not supported by peer", lcn));
return PVMFFailure;
}
int& num_parameter_elements,
PvmiCapabilityContext context)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::getParametersSync"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::getParametersSync", lcn));
OSCL_UNUSED_ARG(session);
OSCL_UNUSED_ARG(context);
num_parameter_elements);
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::getParametersSync: Error - AllocateKvp failed. status=%d", status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::getParametersSync: Error - AllocateKvp failed. status=%d", lcn, status));
return status;
}
PVCodecType_t codec_type = GetCodecType(iDataType);
status = VerifyAndSetParameter(&(parameters[i]), true);
if (status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::setParametersSync: Error - VerifiyAndSetParameter failed on parameter #%d", i));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::setParametersSync: Error - VerifiyAndSetParameter failed on parameter #%d", lcn, i));
ret_kvp = &(parameters[i]);
/* Silently ignore unrecognized codecs untill CapEx is supported by peer */
//OSCL_LEAVE(OsclErrArgument);
PVMFStatus H223IncomingChannel::VerifyAndSetParameter(PvmiKvp* aKvp, bool aSetParam)
{
OSCL_UNUSED_ARG(aSetParam);
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::VerifyAndSetParameter: aKvp=0x%x, aSetParam=%d", aKvp, aSetParam));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::VerifyAndSetParameter: aKvp=0x%x, aSetParam=%d", lcn, aKvp, aSetParam));
if (!aKvp)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::VerifyAndSetParameter: Error - Invalid key-value pair"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::VerifyAndSetParameter: Error - Invalid key-value pair", lcn));
return PVMFFailure;
}
if (iDataType == NULL)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::VerifyAndSetParameter: Error - DataType == NULL"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::VerifyAndSetParameter: Error - DataType == NULL", lcn));
return PVMFErrNotSupported;
}
PVMFFormatType lcn_format_type = PVCodecTypeToPVMFFormatType(codec_type);
if (lcn_format_type != aKvp->value.pChar_value)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::VerifyAndSetParameter: Error - Output format %s not supported", aKvp->value.pChar_value));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::VerifyAndSetParameter: Error - Output format %s not supported", lcn, aKvp->value.pChar_value));
return PVMFErrNotSupported;
}
}
if (aActivity.iType != PVMF_PORT_ACTIVITY_OUTGOING_MSG &&
aActivity.iType != PVMF_PORT_ACTIVITY_CONNECTED_PORT_READY)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::HandlePortActivity Unhandled port activity: %d", aActivity.iType));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::HandlePortActivity Unhandled port activity: %d", lcn, aActivity.iType));
return;
}
PVMFStatus aStatus;
aStatus = Send();
if (aStatus != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::HandlePortActivity Failed to DeQueue incoming message: %d", aStatus));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::HandlePortActivity Failed to DeQueue incoming message: %d", lcn, aStatus));
break;
}
}
{
// Output queue is busy, so wait for the output queue being ready
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
- (0, "H223IncomingChannel::SendBeginOfMediaStreamCommand: Outgoing queue busy. "));
+ (0, "H223IncomingChannel(%d)::SendBeginOfMediaStreamCommand: Outgoing queue busy. ", lcn));
return status;
}
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::SendBeginOfMediaStreamCommand() BOS Sent StreamId %d ", streamID));
+ iBosMessageSent = true;
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::SendBeginOfMediaStreamCommand() BOS Sent StreamId %d ", lcn, streamID));
return status;
}
-void H223IncomingChannel::SetSampleTimestamps(PVMFTimestamp& aTSOffset)
-{
- iRenderingSkew = iAudioLatency - iVideoLatency;
- uint32 skewDelta = 0;
- if (iRenderingSkew >= (int32)iIncomingSkew)
- {
- skewDelta = iRenderingSkew - iIncomingSkew;
- if (iMediaType.isCompressed() && iMediaType.isAudio())
- {
- aTSOffset = (PVMFTimestamp)(iAudioLatency);
- }
- else if (iMediaType.isCompressed() && iMediaType.isVideo())
- {
- aTSOffset = (PVMFTimestamp)(iVideoLatency + skewDelta + PARSING_JITTER_DURATION);
- }
- }
- else if (iRenderingSkew < (int32)iIncomingSkew)
- {
- skewDelta = iIncomingSkew - iRenderingSkew;
- if (iMediaType.isCompressed() && iMediaType.isAudio())
- {
- aTSOffset = (PVMFTimestamp)(iAudioLatency + skewDelta);
- }
- else if (iMediaType.isCompressed() && iMediaType.isVideo())
- {
- aTSOffset = (PVMFTimestamp)(iVideoLatency + PARSING_JITTER_DURATION);
- }
- }
-
-#ifdef LIP_SYNC_TESTING
-
- /**************************************************************************************************
- this is the check, to get unique sample TS on dummy output node side.So for this purpose, we are
- checking the original video TS with the previous TS.If this condition is true then only we are
- modifying the value of aTSOffset.
-
- ***************************************************************************************************/
-
- if ((g_CheckSampleTime != g_RecTimeStamp) && (iParam->iCompressed == false))
- {
- g_CheckSampleTime = g_RecTimeStamp;
- g_Checkcount++;
- aTSOffset += g_Checkcount;
-
- }
-#endif
-
- aTSOffset += iCurTimestamp;
-}
-
/* *****************************************************************************************************
* Function : DetectSkewInd()
* Date : 6/15/2009
if (g_TotalCountIncm == 0)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "Not be able to calculate RMS because Total count value is zero TotalCount=%d", g_TotalCountIncm));
+ (0, "Not be able to calculate RMS because Total count value is zero TotalCount=%d", lcn, g_TotalCountIncm));
}
else
if (CheckFrameBoundary((uint8 *)memFrag.getMemFragPtr(), memFrag.getMemFragSize(), aMediaData->getErrorsFlag()))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel::::DispatchOutgoingMsg, frame found\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::::DispatchOutgoingMsg, frame found\n", lcn));
//If buffer exists then send it.
- if (iVideoFrame.GetRep())
+ if (iVideoFrame.GetRep() && iVideoFrame->getFilledSize())
{
CallSendVideoFrame(aMediaData);
iVideoFrame->setTimestamp(aMediaData->getTimestamp());
aMediaData->getMediaFragment(i, memFrag);
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel::::DispatchOutgoingMsg, frag size %d, idx %d\n", memFrag.getMemFragSize(), i));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::::DispatchOutgoingMsg, frag size %d, idx %d\n", lcn, memFrag.getMemFragSize(), i));
if (memFrag.getMemFragSize() > iVideoFrame->getCapacity() - iVideoFrame->getFilledSize())
{
CallSendVideoFrame(aMediaData);
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel::::DispatchOutgoingMsg, frag cannot fit into video buffer\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel(%d)::::DispatchOutgoingMsg, frag cannot fit into video buffer\n", lcn));
}
if (PVMFSuccess != SendAudioFrame(aMediaData))
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_INFO,
- (0, "H223IncomingChannel::DispatchOutgoingMsg - Sending audio failed, clearing queue"));
+ (0, "H223IncomingChannel(%d)::DispatchOutgoingMsg - Sending audio failed, clearing queue", lcn));
iAudioDataQueue.clear();
}
}
PVMFStatus dispatch_status = QueueOutgoingMsg(mediaMsg);
if (dispatch_status != PVMFSuccess)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::DispatchOutgoingMsg Failed to queue outgoing control message lcn=%d, status=%d", lcn, dispatch_status));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::DispatchOutgoingMsg Failed to queue outgoing control message status=%d", lcn, dispatch_status));
status = dispatch_status;
}
}
else
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::DispatchOutgoingMsg lcn=%d Queue not connected", lcn));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::DispatchOutgoingMsg Queue not connected", lcn));
}
return status;
if (IsConnected())
{
- convertToPVMFMediaMsg(mediaMsg, iVideoFrame);
- PVMFStatus dispatch_status = QueueOutgoingMsg(mediaMsg);
- if (dispatch_status != PVMFSuccess)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::SendVideoFrame Failed to queue outgoing media message lcn=%d, status=%d", lcn, dispatch_status));
+ DispatchMessage(iVideoFrame);
- }
#ifdef LIP_SYNC_TESTING
g_IncmVideoTS = iVideoFrame->getTimestamp();
CalculateRMSInfo(g_IncmVideoTS, g_IncmAudioTS);
#endif
-
iVideoFrame.Unbind();
}
-
-
ipVideoFrameAlloc->ResizeMemoryFragment(mediaDataImpl);
uint32 MediaMsgAllocOverhead = ipVideoFrameAlloc->GetMediaMsgAllocationOverheadBytes();
uint32 LargestAvilableChunk = ipVideoFrameReszMemPool->getLargestContiguousFreeBlockSize();
tempImpl = ipVideoFrameAlloc->allocate(iMax_Chunk_Size);
if (!tempImpl)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::SendVideoFrame , Max_Chunk_size Allocation failed\n"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel(%d)::SendVideoFrame , Max_Chunk_size Allocation failed\n", lcn));
iVideoFrame.Unbind();
}
OSCL_TRY(err, iVideoFrame = PVMFMediaData::createMediaData(tempImpl, ipVideoDataMemPool););
OSCL_FIRST_CATCH_ANY(err,
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::::SendVideoFrame, Error: createMediaData failed, err=%d", err));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::SendVideoFrame, Error: createMediaData failed, err=%d", lcn, err));
return PVMFFailure;
);
int32 err = 0;
OSCL_TRY(err, status = SendVideoFrame(aMediaData););
OSCL_FIRST_CATCH_ANY(err,
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::::DispatchOutgoingMsg, Error: SendVideoFrame failed, err=%d", err));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::DispatchOutgoingMsg, Error: SendVideoFrame failed, err=%d", lcn, err));
return PVMFFailure;
);
return status;
PVMFStatus H223IncomingChannel::SendAudioFrame(PVMFSharedMediaDataPtr aMediaDataPtr)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::SendAudioFrame"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::SendAudioFrame", lcn));
int32 err = 0;
- // push a new frame to queue
- OSCL_TRY(err, iAudioDataQueue.push_back(aMediaDataPtr));
- OSCL_FIRST_CATCH_ANY(err,
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "H223IncomingChannel::SendAudioFrame - Error - No Memory"));
- return PVMFErrNoMemory;
- );
+ if (ipAudioDtxTimer)
+ {
+ ipAudioDtxTimer->Cancel(AMR_TIMER_ID);
+ }
+
+ if (aMediaDataPtr)
+ {
+ // push a new frame to queue
+ OSCL_TRY(err, iAudioDataQueue.push_back(aMediaDataPtr));
+ OSCL_FIRST_CATCH_ANY(err,
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "H223IncomingChannel(%d)::SendAudioFrame - Error - No Memory", lcn));
+ return PVMFErrNoMemory;
+ );
+ }
// we keep small buffer filled so we can have more accurate estimation of timestamps
// following is based on a fact that we are always receiving data late.
// if it is, send all data from queue
if (back->getFilledSize() <= AMR_SID_SIZE)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel::SendAudioFrame - SID frame detected"));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::SendAudioFrame - SID frame detected", lcn));
+ dataQueueLimit = 1;
+ }
+
+ if (!aMediaDataPtr)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::SendAudioFrame - Flushing", lcn));
dataQueueLimit = 1;
}
// get the smallest from ts and future timestamp
// this will remove possible delay of current ts
- uint16 size = dataQueueSize * AMR_FRAME_SIZE_MS;
+ uint16 size = OSCL_STATIC_CAST(uint16, dataQueueSize * AMR_FRAME_SIZE_MS);
PVMFTimestamp fts = front->getTimestamp();
PVMFTimestamp bts = back->getTimestamp();
// it is also more likely to receive less than 50 frame/s than over 50fps.
if (ts > (fts + AMR_JITTER))
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel::RemoveAudioFrame, size(%d) origTS(%d) TS(%d)\n", iAudioDataQueue[0]->getFilledSize(), fts, ts));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel(%d)::RemoveAudioFrame, size(%d) origTS(%d) TS(%d)\n", lcn, iAudioDataQueue[0]->getFilledSize(), fts, ts));
// remove this frame
- iAudioDataQueue[0].Unbind();
iAudioDataQueue.erase(iAudioDataQueue.begin());
}
else
// smoothen the time stamp
ts = ts - ts % AMR_FRAME_SIZE_MS;
- // sending frame here.
- OsclSharedPtr<PVMFMediaMsg> mediaMsg;
-
// set length, marker, timestamp for new media message
iAudioDataQueue[0]->setMarkerInfo(PVMF_MEDIA_DATA_MARKER_INFO_M_BIT);
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel::SendAudioFrame, size(%d) origTS(%d) TS(%d)\n", iAudioDataQueue[0]->getFilledSize(), fts, ts));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "H223IncomingChannel(%d)::SendAudioFrame, size(%d) origTS(%d) TS(%d)\n", lcn, iAudioDataQueue[0]->getFilledSize(), fts, ts));
iAudioDataQueue[0]->setTimestamp(ts);
iAudioDataQueue[0]->setSeqNum(++iAudioFrameNum);
- convertToPVMFMediaMsg(mediaMsg, iAudioDataQueue[0]);
- // send message
- QueueOutgoingMsg(mediaMsg);
+ DispatchMessage(iAudioDataQueue[0]);
#ifdef LIP_SYNC_TESTING
g_IncmAudioTS = ts;
iLastAudioTS = ts;
// remove data from queue
- iAudioDataQueue[0].Unbind();
iAudioDataQueue.erase(iAudioDataQueue.begin());
}
- dataQueueSize = iAudioDataQueue.size();
+ dataQueueSize = OSCL_STATIC_CAST(uint16, iAudioDataQueue.size());
+ }
+
+ if (ipAudioDtxTimer)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::SendAudioFrame - Start new timer for ts(%d)", lcn, iCurTimestamp));
+ ipAudioDtxTimer->Request(AMR_TIMER_ID, OSCL_STATIC_CAST(int32, iCurTimestamp), 1, this);
}
return PVMFSuccess;
}
+void H223IncomingChannel::TimeoutOccurred(int32 aTimerID, int32 aTimeoutInfo)
+{
+ OSCL_UNUSED_ARG(aTimerID);
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::TimeoutOccurred, TimerId(%d) TimeoutInfo(%d)", lcn, aTimerID, aTimeoutInfo));
+
+ uint32 timeout = OSCL_STATIC_CAST(uint32, aTimeoutInfo);
+ // if not no audio is sent during timeout we have problems receiving new data
+ if (timeout == iCurTimestamp)
+ {
+ // if we have data in buffer
+ if (iAudioDataQueue.size())
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::TimeoutOccurred - Flush audio", lcn));
+ PVMFSharedMediaDataPtr mediaData;
+
+ if (iPaused) return;
+
+ SendAudioFrame(mediaData);
+ }
+ else
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::TimeoutOccurred - Create no data", lcn));
+
+ if (!iPaused)
+ {
+ int leavecode = 0;
+ PVMFSharedMediaDataPtr mediaData;
+ if (CreateNoDataAudioFrame(mediaData))
+ {
+ // don't let this leave as mediaData would be leaked
+ OSCL_TRY(leavecode, SendAudioFrame(mediaData););
+ OSCL_FIRST_CATCH_ANY(leavecode,
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel(%d)::TimeoutOccurred, Error: SendAudioFrame failed, err=%d", lcn, leavecode));
+ );
+ }
+ }
+ }
+ }
+}
+
+void H223IncomingChannel::UpdateCurrentTimestamp()
+{
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::UpdateTimestamp", lcn));
+ if (!iClock)
+ {
+ return;
+ }
+
+ bool overflow = false;
+ PVMFTimestamp timestamp;
+
+ // get the current time
+ iClock->GetCurrentTime32(timestamp, overflow, PVMF_MEDIA_CLOCK_MSEC);
+
+ if (overflow)
+ {
+ // we need to clean the queue and send a new bos message as previous clock value was higher than the new one
+ // best way is to do this is to do pause/resume
+ Pause();
+ Resume();
+ }
+
+ // make sure that the new timestamp is not the same as previous one
+ iCurTimestamp = (iCurTimestamp < timestamp) ? timestamp : iCurTimestamp + 1;
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223IncomingChannel(%d)::UpdateCurrentTimestamp - update current ts(%u)", lcn, iCurTimestamp));
+}
+
+PVMFStatus H223IncomingChannel::DispatchMessage(PVMFSharedMediaDataPtr& arMediaDataPtr)
+{
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::DispatchMessage", lcn));
+
+ PVMFStatus dispatchStatus = PVMFNotSet;
+ OsclSharedPtr<PVMFMediaMsg> mediaMsg;
+
+ // convert to media message
+ convertToPVMFMediaMsg(mediaMsg, arMediaDataPtr);
+
+ // send media message if bos message is already sent
+ if (IsResumable())
+ {
+ dispatchStatus = QueueOutgoingMsg(mediaMsg);
+ }
+ else
+ {
+ dispatchStatus = PVMFErrInvalidState;
+ }
+
+ if (dispatchStatus != PVMFSuccess)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
+ (0, "H223IncomingChannel(%d)::DispatchMessage Failed to queue outgoing media message status=%d", lcn, dispatchStatus));
+ }
+ return dispatchStatus;
+}
+
+bool H223IncomingChannel::IsResumable()
+{
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel(%d)::IsResumable", lcn));
+ // Bos message is needed at the beginning of stream
+ // It is also needed in reposition, like in the case of pause
+ // Only if bos message is sent media message can be send to port
+ return (iBosMessageSent || (SendBeginOfStreamMediaCommand() == PVMFSuccess));
+}
+
+PVMFStatus H223IncomingChannel::CreateNoDataAudioFrame(PVMFSharedMediaDataPtr &arMediaDataPtr)
+{
+ int leavecode = 0;
+
+ // Create new media data buffer
+ OsclSharedPtr<PVMFMediaDataImpl> mediaDataImpl = iMediaFragGroupAlloc->allocate();
+
+ // set no data frame as payload
+ OsclRefCounterMemFrag memFrag;
+
+ OSCL_TRY(leavecode, memFrag = iMemFragmentAlloc.get());
+ OSCL_FIRST_CATCH_ANY(leavecode,
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel(%d)::TimeoutOccurred, Error: Mem frag alloc leaved, err=%d", lcn, leavecode));
+ return PVMFErrNoMemory;
+ );
+ if (memFrag.getMemFragPtr() == NULL)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel(%d)::TimeoutOccurred, Error: Mem frag alloc failed", lcn));
+ return PVMFErrNoMemory;
+ }
+ *((uint8*)memFrag.getMemFragPtr()) = AMR_NO_DATA;
+ memFrag.getMemFrag().len = AMR_NODATA_SIZE;
+
+ mediaDataImpl->appendMediaFragment(memFrag); // this does not leave
+
+ OSCL_TRY(leavecode, arMediaDataPtr = PVMFMediaData::createMediaData(mediaDataImpl, iMediaMsgMemoryPool););
+ OSCL_FIRST_CATCH_ANY(leavecode,
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223IncomingChannel(%d)::TimeoutOccurred, Error: Create Media Data, err=%d", lcn, leavecode));
+ return PVMFErrNoMemory;
+ );
+
+ // set timestamp for no data
+ UpdateCurrentTimestamp();
+ arMediaDataPtr->setTimestamp(iCurTimestamp);
+ return PVMFSuccess;
+}