mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1637450 - P2 - Access remote SSRC from any thread;r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D78827
This commit is contained in:
parent
8108184b4f
commit
87986ab67c
@ -493,6 +493,7 @@ WebrtcVideoConduit::WebrtcVideoConduit(
|
||||
this) // 'this' is stored but not dereferenced in the constructor.
|
||||
,
|
||||
mRecvSSRC(0),
|
||||
mRemoteSSRC(0),
|
||||
mVideoStatsTimer(NS_NewTimer()),
|
||||
mRtpSourceObserver(new RtpSourceObserver(mCall->GetTimestampMaker())) {
|
||||
mCall->RegisterConduit(this);
|
||||
@ -1035,6 +1036,7 @@ bool WebrtcVideoConduit::SetRemoteSSRCLocked(uint32_t ssrc, uint32_t rtxSsrc) {
|
||||
}
|
||||
}
|
||||
|
||||
mRemoteSSRC = ssrc;
|
||||
mRecvStreamConfig.rtp.remote_ssrc = ssrc;
|
||||
mRecvStreamConfig.rtp.rtx_ssrc = rtxSsrc;
|
||||
mStsThread->Dispatch(NS_NewRunnableFunction(
|
||||
@ -1083,18 +1085,14 @@ bool WebrtcVideoConduit::UnsetRemoteSSRC(uint32_t ssrc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebrtcVideoConduit::GetRemoteSSRC(unsigned int* ssrc) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
bool WebrtcVideoConduit::GetRemoteSSRC(uint32_t* ssrc) {
|
||||
if (NS_IsMainThread()) {
|
||||
if (!mRecvStream) {
|
||||
return false;
|
||||
}
|
||||
*ssrc = mRecvStream->GetStats().ssrc;
|
||||
} else {
|
||||
ASSERT_ON_THREAD(mStsThread);
|
||||
*ssrc = mRecvStreamStats.Ssrc();
|
||||
}
|
||||
// libwebrtc uses 0 to mean a lack of SSRC. That is not to spec.
|
||||
*ssrc = mRemoteSSRC;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2310,7 +2308,7 @@ void WebrtcVideoConduit::OnFrame(const webrtc::VideoFrame& video_frame) {
|
||||
|
||||
uint32_t remoteSsrc;
|
||||
if (!GetRemoteSSRC(&remoteSsrc) && needsNewHistoryElement) {
|
||||
// Frame was decoded after the connection
|
||||
// Frame was decoded after the connection ended
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -249,6 +249,7 @@ class WebrtcVideoConduit
|
||||
std::vector<uint32_t> GetLocalSSRCs() override;
|
||||
bool SetLocalSSRCs(const std::vector<uint32_t>& ssrcs,
|
||||
const std::vector<uint32_t>& rtxSsrcs) override;
|
||||
// Can be called from any thread
|
||||
bool GetRemoteSSRC(uint32_t* ssrc) override;
|
||||
bool SetRemoteSSRC(uint32_t ssrc, uint32_t rtxSsrc) override;
|
||||
bool UnsetRemoteSSRC(uint32_t ssrc) override;
|
||||
@ -639,6 +640,9 @@ class WebrtcVideoConduit
|
||||
// Accessed during configuration/signaling (main),
|
||||
// and when receiving packets (sts).
|
||||
Atomic<uint32_t> mRecvSSRC; // this can change during a stream!
|
||||
// Accessed from both the STS and main thread for a variety of things
|
||||
// Set when receiving packets
|
||||
Atomic<uint32_t> mRemoteSSRC; // this can change during a stream!
|
||||
|
||||
// Accessed only on mStsThread.
|
||||
RtpPacketQueue mRtpPacketQueue;
|
||||
|
Loading…
Reference in New Issue
Block a user