--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -461,21 +461,16 @@ WebrtcVideoConduit::Init()
CSFLogError(logTag, "%s Initialization Done", __FUNCTION__);
return kMediaConduitNoError;
}
void
WebrtcVideoConduit::Destroy()
{
- for(std::vector<VideoCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
- {
- delete mRecvCodecList[i];
- }
-
// The first one of a pair to be deleted shuts down media for both
//Deal with External Capturer
if(mPtrViECapture)
{
mPtrViECapture->DisconnectCaptureDevice(mCapId);
mPtrViECapture->ReleaseCaptureDevice(mCapId);
mPtrExtCapture = nullptr;
}
@@ -883,23 +878,17 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
// values SetReceiveCodec() cares about are name, type, maxbitrate
if(mPtrViECodec->SetReceiveCodec(mChannel,video_codec) == -1)
{
CSFLogError(logTag, "%s Invalid Receive Codec %d ", __FUNCTION__,
mPtrViEBase->LastError());
} else {
CSFLogError(logTag, "%s Successfully Set the codec %s", __FUNCTION__,
codecConfigList[i]->mName.c_str());
- if(CopyCodecToDB(codecConfigList[i]))
- {
- success = true;
- } else {
- CSFLogError(logTag,"%s Unable to update Codec Database", __FUNCTION__);
- return kMediaConduitUnknownError;
- }
+ success = true;
}
} else {
//Retrieve pre-populated codec structure for our codec.
for(int idx=0; idx < mPtrViECodec->NumberOfCodecs(); idx++)
{
if(mPtrViECodec->GetCodec(idx, video_codec) == 0)
{
payloadName = video_codec.plName;
@@ -908,23 +897,17 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
CodecConfigToWebRTCCodec(codecConfigList[i], video_codec);
if(mPtrViECodec->SetReceiveCodec(mChannel,video_codec) == -1)
{
CSFLogError(logTag, "%s Invalid Receive Codec %d ", __FUNCTION__,
mPtrViEBase->LastError());
} else {
CSFLogError(logTag, "%s Successfully Set the codec %s", __FUNCTION__,
codecConfigList[i]->mName.c_str());
- if(CopyCodecToDB(codecConfigList[i]))
- {
- success = true;
- } else {
- CSFLogError(logTag,"%s Unable to update Codec Database", __FUNCTION__);
- return kMediaConduitUnknownError;
- }
+ success = true;
}
break; //we found a match
}
}
}//end for codeclist
}
}//end for
@@ -1044,17 +1027,16 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
if (condError != kMediaConduitNoError) {
return condError;
}
// by now we should be successfully started the reception
CSFLogDebug(logTag, "REMB enabled for video stream %s",
(use_remb ? "yes" : "no"));
mPtrRTP->SetRembStatus(mChannel, use_remb, true);
- DumpCodecDB();
return kMediaConduitNoError;
}
template<typename T>
T MinIgnoreZero(const T& a, const T& b)
{
return std::min(a? a:b, b? b:a);
}
@@ -1993,116 +1975,41 @@ WebrtcVideoConduit::CodecConfigToWebRTCC
// webrtc.org expects simulcast streams to be ordered by increasing
// fidelity, our jsep code does the opposite.
cinst.simulcastStream[codecInfo->mSimulcastEncodings.size()-i-1] = stream;
}
cinst.numberOfSimulcastStreams = codecInfo->mSimulcastEncodings.size();
}
-//Copy the codec passed into Conduit's database
-bool
-WebrtcVideoConduit::CopyCodecToDB(const VideoCodecConfig* codecInfo)
-{
- VideoCodecConfig* cdcConfig = new VideoCodecConfig(*codecInfo);
- mRecvCodecList.push_back(cdcConfig);
- return true;
-}
-
-bool
-WebrtcVideoConduit::CheckCodecsForMatch(const VideoCodecConfig* curCodecConfig,
- const VideoCodecConfig* codecInfo) const
-{
- if(!curCodecConfig)
- {
- return false;
- }
-
- if(curCodecConfig->mType == codecInfo->mType &&
- curCodecConfig->mName.compare(codecInfo->mName) == 0 &&
- curCodecConfig->mEncodingConstraints == codecInfo->mEncodingConstraints)
- {
- return true;
- }
-
- return false;
-}
-
-/**
- * Checks if the codec is already in Conduit's database
- */
-bool
-WebrtcVideoConduit::CheckCodecForMatch(const VideoCodecConfig* codecInfo) const
-{
- //the db should have atleast one codec
- for(std::vector<VideoCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
- {
- if(CheckCodecsForMatch(mRecvCodecList[i],codecInfo))
- {
- //match
- return true;
- }
- }
- //no match or empty local db
- return false;
-}
-
/**
* Perform validation on the codecConfig to be applied
* Verifies if the codec is already applied.
*/
MediaConduitErrorCode
WebrtcVideoConduit::ValidateCodecConfig(const VideoCodecConfig* codecInfo,
bool send)
{
- bool codecAppliedAlready = false;
-
if(!codecInfo)
{
CSFLogError(logTag, "%s Null CodecConfig ", __FUNCTION__);
return kMediaConduitMalformedArgument;
}
if((codecInfo->mName.empty()) ||
(codecInfo->mName.length() >= CODEC_PLNAME_SIZE))
{
CSFLogError(logTag, "%s Invalid Payload Name Length ", __FUNCTION__);
return kMediaConduitMalformedArgument;
}
- //check if we have the same codec already applied
- if(send)
- {
- MutexAutoLock lock(mCodecMutex);
-
- codecAppliedAlready = CheckCodecsForMatch(mCurSendCodecConfig,codecInfo);
- } else {
- codecAppliedAlready = CheckCodecForMatch(codecInfo);
- }
-
- if(codecAppliedAlready)
- {
- CSFLogDebug(logTag, "%s Codec %s Already Applied ", __FUNCTION__, codecInfo->mName.c_str());
- }
return kMediaConduitNoError;
}
void
-WebrtcVideoConduit::DumpCodecDB() const
-{
- for(std::vector<VideoCodecConfig*>::size_type i=0;i<mRecvCodecList.size();i++)
- {
- CSFLogDebug(logTag,"Payload Name: %s", mRecvCodecList[i]->mName.c_str());
- CSFLogDebug(logTag,"Payload Type: %d", mRecvCodecList[i]->mType);
- CSFLogDebug(logTag,"Payload Max Frame Size: %d", mRecvCodecList[i]->mEncodingConstraints.maxFs);
- CSFLogDebug(logTag,"Payload Max Frame Rate: %d", mRecvCodecList[i]->mEncodingConstraints.maxFps);
- }
-}
-
-void
WebrtcVideoConduit::VideoLatencyUpdate(uint64_t newSample)
{
mVideoLatencyAvg = (sRoundingPadding * newSample + sAlphaNum * mVideoLatencyAvg) / sAlphaDen;
}
uint64_t
WebrtcVideoConduit::MozVideoLatencyAvg()
{
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
@@ -340,25 +340,16 @@ private:
//Local database of currently applied receive codecs
typedef std::vector<VideoCodecConfig* > RecvCodecList;
//Function to convert between WebRTC and Conduit codec structures
void CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
webrtc::VideoCodec& cinst);
- // Function to copy a codec structure to Conduit's database
- bool CopyCodecToDB(const VideoCodecConfig* codecInfo);
-
- // Functions to verify if the codec passed is already in
- // conduits database
- bool CheckCodecForMatch(const VideoCodecConfig* codecInfo) const;
- bool CheckCodecsForMatch(const VideoCodecConfig* curCodecConfig,
- const VideoCodecConfig* codecInfo) const;
-
//Checks the codec to be applied
MediaConduitErrorCode ValidateCodecConfig(const VideoCodecConfig* codecInfo, bool send);
//Utility function to dump recv codec database
void DumpCodecDB() const;
// Video Latency Test averaging filter
void VideoLatencyUpdate(uint64_t new_sample);
@@ -383,17 +374,16 @@ private:
webrtc::ViEExternalCapture* mPtrExtCapture;
// Engine state we are concerned with.
mozilla::Atomic<bool> mEngineTransmitting; //If true ==> Transmit Sub-system is up and running
mozilla::Atomic<bool> mEngineReceiving; // if true ==> Receive Sus-sysmtem up and running
int mChannel; // Video Channel for this conduit
int mCapId; // Capturer for this conduit
- RecvCodecList mRecvCodecList;
Mutex mCodecMutex; // protects mCurrSendCodecConfig
nsAutoPtr<VideoCodecConfig> mCurSendCodecConfig;
bool mInReconfig;
unsigned short mLastWidth;
unsigned short mLastHeight;
unsigned short mSendingWidth;