//------------------------------------------------------------------------- void RTPSenderChannelAudio::onPromiseSettled(PromisePtr promise) { ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID())) AutoRecursiveLock lock(*this); step(); if (ZS_DYNAMIC_PTR_CAST(PromiseWithRTPMediaEngineChannelResource, promise)) { } }
//------------------------------------------------------------------------- RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForRTPMediaEnginePtr object) { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); }
//------------------------------------------------------------------------- RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForMediaStreamTrackPtr object) { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); }
//------------------------------------------------------------------------- RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForSettingsPtr object) { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); }
//------------------------------------------------------------------------- RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForMediaStreamTrackFromMediaBasePtr object) { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); }
//----------------------------------------------------------------------- void SDPParser::processSourceLevelValues(SDP &sdp) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { auto current = iter_doNotUse; ++iter_doNotUse; auto &info = (*current); if (AttributeLevel_Source != info.mAttributeLevel) continue; // scope: process line { switch (info.mLineType) { case LineType_Unknown: goto remove_line; case LineType_v_Version: continue; case LineType_o_Origin: continue; case LineType_s_SessionName: continue; case LineType_b_Bandwidth: continue; case LineType_t_Timing: continue; case LineType_a_Attributes: break; case LineType_m_MediaLine: continue; case LineType_c_ConnectionDataLine: continue; } switch (info.mAttribute) { case Attribute_Unknown: break; case Attribute_Group: continue; case Attribute_BundleOnly: continue; case Attribute_MSID: continue; case Attribute_MSIDSemantic: continue; case Attribute_ICEUFrag: continue; case Attribute_ICEPwd: continue; case Attribute_ICEOptions: continue; case Attribute_ICELite: continue; case Attribute_Candidate: continue; case Attribute_EndOfCandidates: continue; case Attribute_Fingerprint: continue; case Attribute_Crypto: continue; case Attribute_Setup: continue; case Attribute_MID: continue; case Attribute_Extmap: continue; case Attribute_SendRecv: continue; case Attribute_SendOnly: continue; case Attribute_RecvOnly: continue; case Attribute_Inactive: continue; case Attribute_RTPMap: continue; case Attirbute_FMTP: { auto fmtpLine = ZS_DYNAMIC_PTR_CAST(AFMTPLine, info.mLineValue); ORTC_THROW_INVALID_PARAMETERS_IF(!fmtpLine->mMLine); ORTC_THROW_INVALID_PARAMETERS_IF(!fmtpLine->mSourceLine); fmtpLine->mSourceLine->mAFMTPLines.push_back(fmtpLine); // no longer point back to mline or source line fmtpLine->mMLine.reset(); fmtpLine->mSourceLine.reset(); goto remove_line; } case Attribute_RTCP: continue; case Attribute_RTCPMux: continue; case Attribute_RTCPFB: continue; case Attribute_RTCPRSize: continue; case Attribute_PTime: continue; case Attribute_MaxPTime: continue; case Attribute_SSRC: continue; case Attribute_SSRCGroup: continue; case Attribute_Simulcast: continue; case Attribute_RID: continue; case Attribute_SCTPPort: continue; case Attribute_MaxMessageSize: continue; } } continue; remove_line: { // no longer need to process this line sdp.mLineInfos.erase(current); } } }
//------------------------------------------------------------------------- RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForRTPSenderChannelPtr object) { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); }
//----------------------------------------------------------------------- void SDPParser::processMediaLevelValues(SDP &sdp) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { auto current = iter_doNotUse; ++iter_doNotUse; auto &info = (*current); if (AttributeLevel_Media != info.mAttributeLevel) continue; // scope: process line { switch (info.mLineType) { case LineType_Unknown: goto remove_line; case LineType_v_Version: continue; case LineType_o_Origin: continue; case LineType_s_SessionName: continue; case LineType_b_Bandwidth: { auto bline = ZS_DYNAMIC_PTR_CAST(BLine, info.mLineValue); ORTC_THROW_INVALID_PARAMETERS_IF(!bline->mMLine); bline->mMLine->mBLines.push_back(bline); bline->mMLine.reset(); // no longer point back to mline goto remove_line; } case LineType_t_Timing: continue; case LineType_a_Attributes: break; case LineType_m_MediaLine: continue; case LineType_c_ConnectionDataLine: { auto cline = ZS_DYNAMIC_PTR_CAST(CLine, info.mLineValue); ORTC_THROW_INVALID_PARAMETERS_IF(!cline->mMLine); ORTC_THROW_INVALID_PARAMETERS_IF((bool)cline->mMLine->mCLine); cline->mMLine->mCLine = cline; cline->mMLine.reset(); // no longer point back to mline goto remove_line; } } auto mediaLine = ZS_DYNAMIC_PTR_CAST(AMediaLine, info.mLineValue); ZS_THROW_INVALID_ASSUMPTION_IF(!mediaLine); MLinePtr mline = mediaLine->mMLine; mediaLine->mMLine.reset(); ORTC_THROW_INVALID_PARAMETERS_IF(!mline); switch (info.mAttribute) { case Attribute_Unknown: break; case Attribute_Group: continue; case Attribute_BundleOnly: continue; case Attribute_MSID: { mline->mAMSIDLines.push_back(ZS_DYNAMIC_PTR_CAST(AMSIDLine, info.mLineValue)); goto remove_line; } case Attribute_MSIDSemantic: continue; case Attribute_ICEUFrag: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mAICEUFragLine); mline->mAICEUFragLine = ZS_DYNAMIC_PTR_CAST(AICEUFragLine, info.mLineValue); goto remove_line; } case Attribute_ICEPwd: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mAICEPwdLine); mline->mAICEPwdLine = ZS_DYNAMIC_PTR_CAST(AICEPwdLine, info.mLineValue); goto remove_line; } case Attribute_ICEOptions: continue; case Attribute_ICELite: continue; case Attribute_Candidate: { mline->mACandidateLines.push_back(ZS_DYNAMIC_PTR_CAST(ACandidateLine, info.mLineValue)); goto remove_line; } case Attribute_EndOfCandidates: continue; case Attribute_Fingerprint: { mline->mAFingerprintLines.push_back(ZS_DYNAMIC_PTR_CAST(AFingerprintLine, info.mLineValue)); goto remove_line; } case Attribute_Crypto: { mline->mACryptoLines.push_back(ZS_DYNAMIC_PTR_CAST(ACryptoLine, info.mLineValue)); goto remove_line; } case Attribute_Setup: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mASetupLine); mline->mASetupLine = ZS_DYNAMIC_PTR_CAST(ASetupLine, info.mLineValue); goto remove_line; } case Attribute_MID: { // NOTE: While technically a=mid is allowed multiple times, within // the context of the jsep draft it's only every used once and // mid would get confused if more than value was present thus // make it illegal. ORTC_THROW_INVALID_PARAMETERS_IF(mline->mAMIDLine); mline->mAMIDLine = ZS_DYNAMIC_PTR_CAST(AMIDLine, info.mLineValue); goto remove_line; } case Attribute_Extmap: { mline->mAExtmapLines.push_back(ZS_DYNAMIC_PTR_CAST(AExtmapLine, info.mLineValue)); goto remove_line; } case Attribute_SendRecv: continue; case Attribute_SendOnly: continue; case Attribute_RecvOnly: continue; case Attribute_Inactive: continue; case Attribute_RTPMap: { mline->mARTPMapLines.push_back(ZS_DYNAMIC_PTR_CAST(ARTPMapLine, info.mLineValue)); goto remove_line; } case Attirbute_FMTP: { mline->mAFMTPLines.push_back(ZS_DYNAMIC_PTR_CAST(AFMTPLine, info.mLineValue)); goto remove_line; } case Attribute_RTCP: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mARTCPLine); mline->mARTCPLine = ZS_DYNAMIC_PTR_CAST(ARTCPLine, info.mLineValue); goto remove_line; } case Attribute_RTCPMux: continue; case Attribute_RTCPFB: { mline->mARTCPFBLines.push_back(ZS_DYNAMIC_PTR_CAST(ARTCPFBLine, info.mLineValue)); goto remove_line; } case Attribute_RTCPRSize: continue; case Attribute_PTime: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mAPTimeLine); mline->mAPTimeLine = ZS_DYNAMIC_PTR_CAST(APTimeLine, info.mLineValue); goto remove_line; } case Attribute_MaxPTime: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mAMaxPTimeLine); mline->mAMaxPTimeLine = ZS_DYNAMIC_PTR_CAST(AMaxPTimeLine, info.mLineValue); goto remove_line; } case Attribute_SSRC: { mline->mASSRCLines.push_back(ZS_DYNAMIC_PTR_CAST(ASSRCLine, info.mLineValue)); goto remove_line; } case Attribute_SSRCGroup: { mline->mASSRCGroupLines.push_back(ZS_DYNAMIC_PTR_CAST(ASSRCGroupLine, info.mLineValue)); goto remove_line; } case Attribute_Simulcast: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mASimulcastLine); mline->mASimulcastLine = ZS_DYNAMIC_PTR_CAST(ASimulcastLine, info.mLineValue); goto remove_line; } case Attribute_RID: { mline->mARIDLines.push_back(ZS_DYNAMIC_PTR_CAST(ARIDLine, info.mLineValue)); goto remove_line; } case Attribute_SCTPPort: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mASCTPPortLine); mline->mASCTPPortLine = ZS_DYNAMIC_PTR_CAST(ASCTPPortLine, info.mLineValue); goto remove_line; } case Attribute_MaxMessageSize: { ORTC_THROW_INVALID_PARAMETERS_IF(mline->mAMaxMessageSize); mline->mAMaxMessageSize = ZS_DYNAMIC_PTR_CAST(AMaxMessageSizeLine, info.mLineValue); goto remove_line; } } } continue; remove_line: { // no longer need to process this line sdp.mLineInfos.erase(current); } } }
//----------------------------------------------------------------------- void SDPParser::processSessionLevelValues(SDP &sdp) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { auto current = iter_doNotUse; ++iter_doNotUse; auto &info = (*current); if (AttributeLevel_Session != info.mAttributeLevel) continue; switch (info.mLineType) { case LineType_Unknown: goto remove_line; case LineType_v_Version: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mVLine); sdp.mVLine = ZS_DYNAMIC_PTR_CAST(VLine, info.mLineValue); goto remove_line; } case LineType_o_Origin: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mOLine); sdp.mOLine = ZS_DYNAMIC_PTR_CAST(OLine, info.mLineValue); goto remove_line; } case LineType_s_SessionName: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mSLine); sdp.mSLine = ZS_DYNAMIC_PTR_CAST(SLine, info.mLineValue); goto remove_line; } case LineType_b_Bandwidth: goto remove_line; case LineType_t_Timing: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mTLine); sdp.mTLine = ZS_DYNAMIC_PTR_CAST(TLine, info.mLineValue); goto remove_line; } case LineType_a_Attributes: break; case LineType_m_MediaLine: { sdp.mMLines.push_back(ZS_DYNAMIC_PTR_CAST(MLine, info.mLineValue)); goto remove_line; } case LineType_c_ConnectionDataLine: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mCLine); sdp.mCLine = ZS_DYNAMIC_PTR_CAST(CLine, info.mLineValue); goto remove_line; } } switch (info.mAttribute) { case Attribute_Unknown: goto remove_line; case Attribute_Group: { sdp.mAGroupLines.push_back(ZS_DYNAMIC_PTR_CAST(AGroupLine, info.mLineValue)); goto remove_line; } case Attribute_BundleOnly: continue; case Attribute_MSID: continue; case Attribute_MSIDSemantic: { sdp.mAMSIDSemanticLines.push_back(ZS_DYNAMIC_PTR_CAST(AMSIDSemanticLine, info.mLineValue)); goto remove_line; } case Attribute_ICEUFrag: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mAICEUFragLine); sdp.mAICEUFragLine = ZS_DYNAMIC_PTR_CAST(AICEUFragLine, info.mLineValue); goto remove_line; } case Attribute_ICEPwd: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mAICEPwdLine); sdp.mAICEPwdLine = ZS_DYNAMIC_PTR_CAST(AICEPwdLine, info.mLineValue); goto remove_line; } case Attribute_ICEOptions: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mAICEOptionsLine); sdp.mAICEOptionsLine = ZS_DYNAMIC_PTR_CAST(AICEOptionsLine, info.mLineValue); goto remove_line; } case Attribute_ICELite: continue; case Attribute_Candidate: continue; case Attribute_EndOfCandidates: continue; case Attribute_Fingerprint: { sdp.mAFingerprintLines.push_back(ZS_DYNAMIC_PTR_CAST(AFingerprintLine, info.mLineValue)); goto remove_line; } case Attribute_Crypto: continue; case Attribute_Setup: { ORTC_THROW_INVALID_PARAMETERS_IF((bool)sdp.mASetupLine); sdp.mASetupLine = ZS_DYNAMIC_PTR_CAST(ASetupLine, info.mLineValue); goto remove_line; } case Attribute_MID: continue; case Attribute_Extmap: { sdp.mAExtmapLines.push_back(ZS_DYNAMIC_PTR_CAST(AExtmapLine, info.mLineValue)); goto remove_line; } case Attribute_SendRecv: continue; case Attribute_SendOnly: continue; case Attribute_RecvOnly: continue; case Attribute_Inactive: continue; case Attribute_RTPMap: continue; case Attirbute_FMTP: continue; case Attribute_RTCP: continue; case Attribute_RTCPMux: continue; case Attribute_RTCPFB: continue; case Attribute_RTCPRSize: continue; case Attribute_PTime: continue; case Attribute_MaxPTime: continue; case Attribute_SSRC: continue; case Attribute_SSRCGroup: continue; case Attribute_Simulcast: continue; case Attribute_RID: continue; case Attribute_SCTPPort: continue; case Attribute_MaxMessageSize: continue; } continue; remove_line: { // no longer need to process this line sdp.mLineInfos.erase(current); } } }
//----------------------------------------------------------------------- void SDPParser::processFlagAttributes(SDP &sdp) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { auto current = iter_doNotUse; ++iter_doNotUse; auto &info = (*current); if (LineType_a_Attributes != info.mLineType) continue; if (!requiresEmptyValue(info.mAttribute)) continue; { // this is a "flag" attribute switch (info.mAttribute) { case Attribute_Unknown: continue; case Attribute_Group: continue; case Attribute_BundleOnly: break; case Attribute_MSID: continue; case Attribute_MSIDSemantic: continue; case Attribute_ICEUFrag: continue; case Attribute_ICEPwd: continue; case Attribute_ICEOptions: continue; case Attribute_ICELite: { sdp.mICELite = true; continue; } case Attribute_Candidate: continue; case Attribute_EndOfCandidates: break; case Attribute_Fingerprint: continue; case Attribute_Crypto: continue; case Attribute_Setup: continue; case Attribute_MID: continue; case Attribute_Extmap: continue; case Attribute_SendRecv: case Attribute_SendOnly: case Attribute_RecvOnly: case Attribute_Inactive: { auto direction = ZS_DYNAMIC_PTR_CAST(AMediaDirectionLine, info.mLineValue); ZS_THROW_INVALID_ASSUMPTION_IF(!direction); if (direction->mMLine) { ORTC_THROW_INVALID_PARAMETERS_IF(direction->mMLine->mMediaDirection.hasValue()); direction->mMLine->mMediaDirection = direction->mDirection; } else { ORTC_THROW_INVALID_PARAMETERS_IF(sdp.mMediaDirection.hasValue()); sdp.mMediaDirection = direction->mDirection; } goto remove_line;; } case Attribute_RTPMap: continue; case Attirbute_FMTP: continue; case Attribute_RTCP: continue; case Attribute_RTCPMux: break; case Attribute_RTCPFB: continue; case Attribute_RTCPRSize: break; case Attribute_PTime: continue; case Attribute_MaxPTime: continue; case Attribute_SSRC: continue; case Attribute_SSRCGroup: continue; case Attribute_Simulcast: continue; case Attribute_RID: continue; case Attribute_SCTPPort: continue; case Attribute_MaxMessageSize: continue; } auto flag = ZS_DYNAMIC_PTR_CAST(AMediaFlagLine, info.mLineValue); ZS_THROW_INVALID_ASSUMPTION_IF(!flag); ORTC_THROW_INVALID_PARAMETERS_IF(!flag->mMLine); switch (info.mAttribute) { case Attribute_BundleOnly: flag->mMLine->mBundleOnly = true; goto remove_line; case Attribute_EndOfCandidates: flag->mMLine->mEndOfCandidates = true; goto remove_line; case Attribute_RTCPMux: flag->mMLine->mRTCPMux = true; goto remove_line; case Attribute_RTCPRSize: flag->mMLine->mRTCPRSize = true; goto remove_line; default: break; } } continue; remove_line: { // no longer need to process this line sdp.mLineInfos.erase(current); } } }
//------------------------------------------------------------------------- ORTCPtr ORTC::convert(IORTCPtr object) { return ZS_DYNAMIC_PTR_CAST(ORTC, object); }
//------------------------------------------------------------------------- MediaDevicesPtr MediaDevices::convert(IMediaDevicesPtr object) { return ZS_DYNAMIC_PTR_CAST(MediaDevices, object); }