Changeset 244034 in webkit
- Timestamp:
- Apr 8, 2019 1:22:11 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r244032 r244034 1 2019-04-08 Youenn Fablet <youenn@apple.com> 2 3 LibWebRTCMediaEndpoint does not need to hop to the signaling thread to gather stats 4 https://bugs.webkit.org/show_bug.cgi?id=196697 5 <rdar://problem/47477113> 6 7 Reviewed by Eric Carlson. 8 9 It is not thread safe to use m_backend in another thread than the main thread. 10 It is not useful anymore to hop to the signaling thread to gather stats. 11 No change of behavior. 12 13 * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: 14 (WebCore::LibWebRTCMediaEndpoint::getStats): 15 (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging): 16 1 17 2019-04-08 Antoine Quint <graouts@apple.com> 2 18 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
r243163 r244034 285 285 } 286 286 287 void LibWebRTCMediaEndpoint::getStats(Ref<DeferredPromise>&& promise, WTF::Function<void(rtc::scoped_refptr<LibWebRTCStatsCollector>&&)>&& getStatsFunction)288 { 289 auto collector =LibWebRTCStatsCollector::create([promise = WTFMove(promise), protectedThis = makeRef(*this)]() mutable -> RefPtr<RTCStatsReport> {287 rtc::scoped_refptr<LibWebRTCStatsCollector> LibWebRTCMediaEndpoint::createStatsCollector(Ref<DeferredPromise>&& promise) 288 { 289 return LibWebRTCStatsCollector::create([promise = WTFMove(promise), protectedThis = makeRef(*this)]() mutable -> RefPtr<RTCStatsReport> { 290 290 ASSERT(isMainThread()); 291 291 if (protectedThis->isStopped()) … … 301 301 return report; 302 302 }); 303 LibWebRTCProvider::callOnWebRTCSignalingThread([getStatsFunction = WTFMove(getStatsFunction), collector = WTFMove(collector)]() mutable {304 getStatsFunction(WTFMove(collector));305 });306 303 } 307 304 308 305 void LibWebRTCMediaEndpoint::getStats(Ref<DeferredPromise>&& promise) 309 306 { 310 getStats(WTFMove(promise), [this](auto&& collector) { 311 if (m_backend) 312 m_backend->GetStats(WTFMove(collector)); 313 }); 307 if (m_backend) 308 m_backend->GetStats(createStatsCollector(WTFMove(promise))); 314 309 } 315 310 316 311 void LibWebRTCMediaEndpoint::getStats(webrtc::RtpReceiverInterface& receiver, Ref<DeferredPromise>&& promise) 317 312 { 318 getStats(WTFMove(promise), [this, receiver = rtc::scoped_refptr<webrtc::RtpReceiverInterface>(&receiver)](auto&& collector) mutable { 319 if (m_backend) 320 m_backend->GetStats(WTFMove(receiver), WTFMove(collector)); 321 }); 313 if (m_backend) 314 m_backend->GetStats(rtc::scoped_refptr<webrtc::RtpReceiverInterface>(&receiver), createStatsCollector(WTFMove(promise))); 322 315 } 323 316 324 317 void LibWebRTCMediaEndpoint::getStats(webrtc::RtpSenderInterface& sender, Ref<DeferredPromise>&& promise) 325 318 { 326 getStats(WTFMove(promise), [this, sender = rtc::scoped_refptr<webrtc::RtpSenderInterface>(&sender)](auto&& collector) mutable { 327 if (m_backend) 328 m_backend->GetStats(WTFMove(sender), WTFMove(collector)); 329 }); 319 if (m_backend) 320 m_backend->GetStats(rtc::scoped_refptr<webrtc::RtpSenderInterface>(&sender), createStatsCollector(WTFMove(promise))); 330 321 } 331 322 … … 833 824 void LibWebRTCMediaEndpoint::gatherStatsForLogging() 834 825 { 835 LibWebRTCProvider::callOnWebRTCSignalingThread([protectedThis = makeRef(*this)] { 836 if (protectedThis->m_backend) 837 protectedThis->m_backend->GetStats(protectedThis.ptr()); 838 }); 826 m_backend->GetStats(this); 839 827 } 840 828 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h
r240152 r244034 154 154 void stopLoggingStats(); 155 155 156 void getStats(Ref<DeferredPromise>&&, WTF::Function<void(rtc::scoped_refptr<LibWebRTCStatsCollector>&&)>&&);156 rtc::scoped_refptr<LibWebRTCStatsCollector> createStatsCollector(Ref<DeferredPromise>&&); 157 157 158 158 MediaStream& mediaStreamFromRTCStream(webrtc::MediaStreamInterface&);
Note: See TracChangeset
for help on using the changeset viewer.