Changeset 222271 in webkit
- Timestamp:
- Sep 20, 2017 10:55:27 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r222270 r222271 1 2017-09-20 Eric Carlson <eric.carlson@apple.com> 2 3 Switch PeerConnection to release logging 4 https://bugs.webkit.org/show_bug.cgi?id=177193 5 <rdar://problem/34529014> 6 7 Reviewed by Youenn Fablet. 8 9 * Modules/mediastream/PeerConnectionBackend.cpp: 10 (WebCore::PeerConnectionBackend::PeerConnectionBackend): 11 (WebCore::PeerConnectionBackend::createOfferSucceeded): 12 (WebCore::PeerConnectionBackend::createOfferFailed): 13 (WebCore::PeerConnectionBackend::createAnswerSucceeded): 14 (WebCore::PeerConnectionBackend::createAnswerFailed): 15 (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded): 16 (WebCore::PeerConnectionBackend::setLocalDescriptionFailed): 17 (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded): 18 (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed): 19 (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): 20 (WebCore::PeerConnectionBackend::addIceCandidateFailed): 21 (WebCore::PeerConnectionBackend::newICECandidate): 22 (WebCore::PeerConnectionBackend::doneGatheringCandidates): 23 (WebCore::PeerConnectionBackend::logChannel const): 24 * Modules/mediastream/PeerConnectionBackend.h: 25 (WebCore::PeerConnectionBackend::PeerConnectionBackend): Deleted. 26 27 * Modules/mediastream/RTCPeerConnection.cpp: 28 (WebCore::RTCPeerConnection::RTCPeerConnection): 29 (WebCore::RTCPeerConnection::~RTCPeerConnection): 30 (WebCore::RTCPeerConnection::addTrack): 31 (WebCore::RTCPeerConnection::removeTrack): 32 (WebCore::RTCPeerConnection::addTransceiver): 33 (WebCore::RTCPeerConnection::queuedCreateOffer): 34 (WebCore::RTCPeerConnection::queuedCreateAnswer): 35 (WebCore::RTCPeerConnection::queuedSetLocalDescription): 36 (WebCore::RTCPeerConnection::queuedSetRemoteDescription): 37 (WebCore::RTCPeerConnection::queuedAddIceCandidate): 38 (WebCore::RTCPeerConnection::initializeConfiguration): 39 (WebCore::RTCPeerConnection::setConfiguration): 40 (WebCore::RTCPeerConnection::createDataChannel): 41 (WebCore::RTCPeerConnection::setSignalingState): 42 (WebCore::RTCPeerConnection::updateIceGatheringState): 43 (WebCore::RTCPeerConnection::updateIceConnectionState): 44 (WebCore::RTCPeerConnection::updateConnectionState): 45 (WebCore::RTCPeerConnection::replaceTrack): 46 (WebCore::RTCPeerConnection::dispatchEvent): 47 (WebCore::RTCPeerConnection::logChannel const): 48 (WebCore::rtcIceGatheringStateToString): Deleted. 49 (WebCore::rtcIceConnectionStateToString): Deleted. 50 * Modules/mediastream/RTCPeerConnection.h: 51 52 * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: 53 (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint): 54 (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): 55 (WebCore::LibWebRTCMediaEndpoint::startLoggingStats): 56 (WebCore::LibWebRTCMediaEndpoint::logChannel const): 57 (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): 58 * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: 59 (PAL::LogArgument<webrtc::RTCStats>::toString): 60 61 * platform/mediastream/RTCIceConnectionState.h: 62 (PAL::LogArgument<WebCore::RTCIceConnectionState>::toString): 63 64 * platform/mediastream/RTCIceGatheringState.h: 65 (PAL::LogArgument<WebCore::RTCIceGatheringState>::toString): 66 67 * platform/mediastream/RTCPeerConnectionState.h: 68 (PAL::LogArgument<WebCore::RTCPeerConnectionState>::toString): 69 70 * platform/mediastream/RTCSignalingState.h: 71 (PAL::LogArgument<WebCore::RTCSignalingState>::toString): 72 1 73 2017-09-20 Chris Dumez <cdumez@apple.com> 2 74 -
trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
r219856 r222271 45 45 namespace WebCore { 46 46 47 using namespace PAL; 48 49 PeerConnectionBackend::PeerConnectionBackend(RTCPeerConnection& peerConnection) 50 : m_peerConnection(peerConnection) 51 #if !RELEASE_LOG_DISABLED 52 , m_logger(peerConnection.logger()) 53 , m_logIdentifier(peerConnection.logIdentifier()) 54 #endif 55 { 56 } 57 47 58 void PeerConnectionBackend::createOffer(RTCOfferOptions&& options, PeerConnection::SessionDescriptionPromise&& promise) 48 59 { … … 57 68 { 58 69 ASSERT(isMainThread()); 59 RELEASE_LOG(WebRTC, "Creating offer succeeded:\n%{public}s\n", sdp.utf8().data());70 ALWAYS_LOG(LOGIDENTIFIER, "Create offer succeeded:\n", sdp); 60 71 61 72 if (m_peerConnection.isClosed()) … … 70 81 { 71 82 ASSERT(isMainThread()); 72 RELEASE_LOG(WebRTC, "Creating offer failed:\n%{public}s\n", exception.message().utf8().data());83 ALWAYS_LOG(LOGIDENTIFIER, "Create offer failed:", exception.message()); 73 84 74 85 if (m_peerConnection.isClosed()) … … 92 103 { 93 104 ASSERT(isMainThread()); 94 RELEASE_LOG(WebRTC, "Creating answer succeeded:\n%{public}s\n", sdp.utf8().data());105 ALWAYS_LOG(LOGIDENTIFIER, "Create answer succeeded:\n", sdp); 95 106 96 107 if (m_peerConnection.isClosed()) … … 105 116 { 106 117 ASSERT(isMainThread()); 107 RELEASE_LOG(WebRTC, "Creating answer failed:\n%{public}s\n", exception.message().utf8().data());118 ALWAYS_LOG(LOGIDENTIFIER, "Create answer failed:", exception.message()); 108 119 109 120 if (m_peerConnection.isClosed()) … … 150 161 { 151 162 ASSERT(isMainThread()); 152 RELEASE_LOG(WebRTC, "Setting local description succeeded\n");163 ALWAYS_LOG(LOGIDENTIFIER); 153 164 154 165 if (m_peerConnection.isClosed()) … … 164 175 { 165 176 ASSERT(isMainThread()); 166 RELEASE_LOG(WebRTC, "Setting local description failed:\n%{public}s\n", exception.message().utf8().data());177 ALWAYS_LOG(LOGIDENTIFIER, "Set local description failed:", exception.message()); 167 178 168 179 if (m_peerConnection.isClosed()) … … 210 221 { 211 222 ASSERT(isMainThread()); 212 RELEASE_LOG(WebRTC, "Setting remote description succeeded\n");223 ALWAYS_LOG(LOGIDENTIFIER, "Set remote description succeeded"); 213 224 214 225 if (m_peerConnection.isClosed()) … … 224 235 { 225 236 ASSERT(isMainThread()); 226 RELEASE_LOG(WebRTC, "Setting remote description failed:\n%{public}s\n", exception.message().utf8().data());237 ALWAYS_LOG(LOGIDENTIFIER, "Set remote description failed:", exception.message()); 227 238 228 239 if (m_peerConnection.isClosed()) … … 256 267 { 257 268 ASSERT(isMainThread()); 258 RELEASE_LOG(WebRTC, "Adding ice candidate succeeded\n");269 ALWAYS_LOG(LOGIDENTIFIER, "Adding ice candidate succeeded"); 259 270 260 271 if (m_peerConnection.isClosed()) … … 271 282 { 272 283 ASSERT(isMainThread()); 273 RELEASE_LOG(WebRTC, "Adding ice candidate failed:\n%{public}s\n", exception.message().utf8().data());284 ALWAYS_LOG(LOGIDENTIFIER, "Adding ice candidate failed:", exception.message()); 274 285 275 286 if (m_peerConnection.isClosed()) … … 350 361 void PeerConnectionBackend::newICECandidate(String&& sdp, String&& mid, unsigned short sdpMLineIndex) 351 362 { 352 RELEASE_LOG(WebRTC, "Gathered ice candidate:\n%{public}s\n", sdp.utf8().data());363 ALWAYS_LOG(LOGIDENTIFIER, "Gathered ice candidate:", sdp); 353 364 354 365 if (!m_shouldFilterICECandidates) { … … 366 377 { 367 378 ASSERT(isMainThread()); 368 RELEASE_LOG(WebRTC, "Finished ice candidate gathering\n");379 ALWAYS_LOG(LOGIDENTIFIER, "Finished ice candidate gathering"); 369 380 370 381 m_peerConnection.fireEvent(RTCPeerConnectionIceEvent::create(false, false, nullptr)); … … 402 413 } 403 414 415 #if !RELEASE_LOG_DISABLED 416 WTFLogChannel& PeerConnectionBackend::logChannel() const 417 { 418 return LogWebRTC; 419 } 420 #endif 421 404 422 } // namespace WebCore 405 423 -
trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
r219393 r222271 38 38 #include "RTCSessionDescription.h" 39 39 #include "RTCSignalingState.h" 40 #include <pal/Logger.h> 41 #include <pal/LoggerHelper.h> 40 42 41 43 namespace WebCore { … … 64 66 using CreatePeerConnectionBackend = std::unique_ptr<PeerConnectionBackend> (*)(RTCPeerConnection&); 65 67 66 class PeerConnectionBackend { 68 class PeerConnectionBackend 69 #if !RELEASE_LOG_DISABLED 70 : public PAL::LoggerHelper 71 #endif 72 { 67 73 public: 68 74 WEBCORE_EXPORT static CreatePeerConnectionBackend create; 69 75 70 PeerConnectionBackend(RTCPeerConnection& peerConnection) : m_peerConnection(peerConnection) { }76 explicit PeerConnectionBackend(RTCPeerConnection&); 71 77 virtual ~PeerConnectionBackend() { } 72 78 … … 113 119 114 120 virtual void applyRotationForOutgoingVideoSources() { } 121 122 #if !RELEASE_LOG_DISABLED 123 const PAL::Logger& logger() const final { return m_logger.get(); } 124 const void* logIdentifier() const final { return m_logIdentifier; } 125 const char* logClassName() const override { return "PeerConnectionBackend"; } 126 WTFLogChannel& logChannel() const final; 127 #endif 115 128 116 129 protected: … … 163 176 Vector<PendingICECandidate> m_pendingICECandidates; 164 177 178 #if !RELEASE_LOG_DISABLED 179 Ref<const PAL::Logger> m_logger; 180 const void* m_logIdentifier; 181 #endif 165 182 bool m_negotiationNeeded { false }; 166 183 }; -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r219856 r222271 53 53 #include "RTCSessionDescription.h" 54 54 #include "RTCTrackEvent.h" 55 #include <wtf/CryptographicallyRandomNumber.h> 55 56 #include <wtf/MainThread.h> 56 57 #include <wtf/UUID.h> … … 82 83 RTCPeerConnection::RTCPeerConnection(ScriptExecutionContext& context) 83 84 : ActiveDOMObject(&context) 85 #if !RELEASE_LOG_DISABLED 86 , m_logger(downcast<Document>(context).logger()) 87 , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber())) 88 #endif 84 89 , m_backend(PeerConnectionBackend::create(*this)) 85 90 { 91 ALWAYS_LOG(LOGIDENTIFIER); 86 92 if (!m_backend) 87 93 m_connectionState = RTCPeerConnectionState::Closed; … … 90 96 RTCPeerConnection::~RTCPeerConnection() 91 97 { 98 ALWAYS_LOG(LOGIDENTIFIER); 92 99 unregisterFromController(); 93 100 stop(); … … 107 114 ExceptionOr<Ref<RTCRtpSender>> RTCPeerConnection::addTrack(Ref<MediaStreamTrack>&& track, const Vector<std::reference_wrapper<MediaStream>>& streams) 108 115 { 116 INFO_LOG(LOGIDENTIFIER); 117 109 118 if (isClosed()) 110 119 return Exception { InvalidStateError }; … … 161 170 ExceptionOr<void> RTCPeerConnection::removeTrack(RTCRtpSender& sender) 162 171 { 172 INFO_LOG(LOGIDENTIFIER); 173 163 174 if (isClosed()) 164 175 return Exception { InvalidStateError }; … … 185 196 ExceptionOr<Ref<RTCRtpTransceiver>> RTCPeerConnection::addTransceiver(AddTransceiverTrackOrKind&& withTrack, const RTCRtpTransceiverInit& init) 186 197 { 198 INFO_LOG(LOGIDENTIFIER); 199 187 200 if (WTF::holds_alternative<String>(withTrack)) { 188 201 const String& kind = WTF::get<String>(withTrack); … … 219 232 void RTCPeerConnection::queuedCreateOffer(RTCOfferOptions&& options, SessionDescriptionPromise&& promise) 220 233 { 221 RELEASE_LOG(WebRTC, "Creating offer\n");234 ALWAYS_LOG(LOGIDENTIFIER); 222 235 if (isClosed()) { 223 236 promise.reject(InvalidStateError); … … 230 243 void RTCPeerConnection::queuedCreateAnswer(RTCAnswerOptions&& options, SessionDescriptionPromise&& promise) 231 244 { 232 RELEASE_LOG(WebRTC, "Creating answer\n");245 ALWAYS_LOG(LOGIDENTIFIER); 233 246 if (isClosed()) { 234 247 promise.reject(InvalidStateError); … … 241 254 void RTCPeerConnection::queuedSetLocalDescription(RTCSessionDescription& description, DOMPromiseDeferred<void>&& promise) 242 255 { 243 RELEASE_LOG(WebRTC, "Setting local description:\n%{public}s\n", description.sdp().utf8().data());256 ALWAYS_LOG(LOGIDENTIFIER, "Setting local description to:\n", description.sdp()); 244 257 if (isClosed()) { 245 258 promise.reject(InvalidStateError); … … 267 280 void RTCPeerConnection::queuedSetRemoteDescription(RTCSessionDescription& description, DOMPromiseDeferred<void>&& promise) 268 281 { 269 RELEASE_LOG(WebRTC, "Setting remote description:\n%{public}s\n", description.sdp().utf8().data());282 ALWAYS_LOG(LOGIDENTIFIER, "Setting remote description to:\n", description.sdp()); 270 283 271 284 if (isClosed()) { … … 293 306 void RTCPeerConnection::queuedAddIceCandidate(RTCIceCandidate* rtcCandidate, DOMPromiseDeferred<void>&& promise) 294 307 { 295 RELEASE_LOG(WebRTC, "Received ice candidate:\n%{public}s\n", rtcCandidate ? rtcCandidate->candidate().utf8().data() : "null");308 ALWAYS_LOG(LOGIDENTIFIER, "Received ice candidate:\n", rtcCandidate ? rtcCandidate->candidate() : "null"); 296 309 297 310 if (isClosed()) { … … 330 343 ExceptionOr<void> RTCPeerConnection::initializeConfiguration(RTCConfiguration&& configuration) 331 344 { 345 INFO_LOG(LOGIDENTIFIER); 346 332 347 auto servers = iceServersFromConfiguration(configuration); 333 348 if (!servers) … … 346 361 if (isClosed()) 347 362 return Exception { InvalidStateError }; 363 364 INFO_LOG(LOGIDENTIFIER); 348 365 349 366 auto servers = iceServersFromConfiguration(configuration); … … 365 382 ExceptionOr<Ref<RTCDataChannel>> RTCPeerConnection::createDataChannel(ScriptExecutionContext& context, String&& label, RTCDataChannelInit&& options) 366 383 { 384 ALWAYS_LOG(LOGIDENTIFIER); 385 367 386 if (isClosed()) 368 387 return Exception { InvalidStateError }; … … 466 485 void RTCPeerConnection::addTransceiver(Ref<RTCRtpTransceiver>&& transceiver) 467 486 { 487 INFO_LOG(LOGIDENTIFIER); 468 488 m_transceiverSet->append(WTFMove(transceiver)); 469 489 } … … 471 491 void RTCPeerConnection::setSignalingState(RTCSignalingState newState) 472 492 { 493 ALWAYS_LOG(LOGIDENTIFIER, newState); 473 494 m_signalingState = newState; 474 495 } 475 496 476 #if !RELEASE_LOG_DISABLED477 static inline const char* rtcIceGatheringStateToString(RTCIceGatheringState newState)478 {479 switch (newState) {480 case RTCIceGatheringState::New:481 return "new";482 case RTCIceGatheringState::Gathering:483 return "gathering";484 case RTCIceGatheringState::Complete:485 return "complete";486 }487 }488 #endif489 490 497 void RTCPeerConnection::updateIceGatheringState(RTCIceGatheringState newState) 491 498 { 492 RELEASE_LOG(WebRTC, "New ICE gathering state: %{public}s\n", rtcIceGatheringStateToString(newState));499 ALWAYS_LOG(LOGIDENTIFIER, newState); 493 500 494 501 scriptExecutionContext()->postTask([protectedThis = makeRef(*this), newState](ScriptExecutionContext&) { … … 502 509 } 503 510 504 #if !RELEASE_LOG_DISABLED505 static inline const char* rtcIceConnectionStateToString(RTCIceConnectionState newState)506 {507 switch (newState) {508 case RTCIceConnectionState::New:509 return "new";510 case RTCIceConnectionState::Checking:511 return "checking";512 case RTCIceConnectionState::Connected:513 return "connected";514 case RTCIceConnectionState::Completed:515 return "completed";516 case RTCIceConnectionState::Failed:517 return "failed";518 case RTCIceConnectionState::Disconnected:519 return "disconnected";520 case RTCIceConnectionState::Closed:521 return "closed";522 }523 }524 #endif525 526 511 void RTCPeerConnection::updateIceConnectionState(RTCIceConnectionState newState) 527 512 { 528 RELEASE_LOG(WebRTC, "New ICE connection state: %{public}s\n", rtcIceConnectionStateToString(newState));513 ALWAYS_LOG(LOGIDENTIFIER, newState); 529 514 530 515 scriptExecutionContext()->postTask([protectedThis = makeRef(*this), newState](ScriptExecutionContext&) { … … 561 546 return; 562 547 548 INFO_LOG(LOGIDENTIFIER, "state changed from: " , m_connectionState, " to ", state); 549 563 550 m_connectionState = state; 564 551 dispatchEvent(Event::create(eventNames().connectionstatechangeEvent, false, false)); … … 595 582 void RTCPeerConnection::replaceTrack(RTCRtpSender& sender, RefPtr<MediaStreamTrack>&& withTrack, DOMPromiseDeferred<void>&& promise) 596 583 { 584 INFO_LOG(LOGIDENTIFIER); 585 597 586 if (!withTrack) { 598 587 scriptExecutionContext()->postTask([protectedSender = makeRef(sender), promise = WTFMove(promise)](ScriptExecutionContext&) mutable { … … 616 605 } 617 606 607 bool RTCPeerConnection::dispatchEvent(Event& event) 608 { 609 DEBUG_LOG(LOGIDENTIFIER, "dispatching '", event.type(), "'"); 610 return EventTarget::dispatchEvent(event); 611 } 612 613 #if !RELEASE_LOG_DISABLED 614 WTFLogChannel& RTCPeerConnection::logChannel() const 615 { 616 return LogWebRTC; 617 } 618 #endif 619 618 620 } // namespace WebCore 619 621 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
r218994 r222271 46 46 #include "RTCRtpTransceiver.h" 47 47 #include "RTCSignalingState.h" 48 #include <pal/LoggerHelper.h> 48 49 49 50 namespace WebCore { … … 64 65 }; 65 66 66 class RTCPeerConnection final : public RefCounted<RTCPeerConnection>, public RTCRtpSender::Backend, public EventTargetWithInlineData, public ActiveDOMObject { 67 class RTCPeerConnection final 68 : public RefCounted<RTCPeerConnection> 69 , public RTCRtpSender::Backend 70 , public EventTargetWithInlineData 71 , public ActiveDOMObject 72 #if !RELEASE_LOG_DISABLED 73 , public PAL::LoggerHelper 74 #endif 75 { 67 76 public: 68 77 static Ref<RTCPeerConnection> create(ScriptExecutionContext&); … … 151 160 bool hasPendingActivity() const final; 152 161 162 #if !RELEASE_LOG_DISABLED 163 const PAL::Logger& logger() const final { return m_logger.get(); } 164 const void* logIdentifier() const final { return m_logIdentifier; } 165 const char* logClassName() const final { return "RTCPeerConnection"; } 166 WTFLogChannel& logChannel() const final; 167 #endif 168 153 169 private: 154 170 RTCPeerConnection(ScriptExecutionContext&); … … 166 182 void refEventTarget() final { ref(); } 167 183 void derefEventTarget() final { deref(); } 184 bool dispatchEvent(Event&) final; 168 185 169 186 // ActiveDOMObject … … 187 204 RTCPeerConnectionState m_connectionState { RTCPeerConnectionState::New }; 188 205 206 #if !RELEASE_LOG_DISABLED 207 Ref<const PAL::Logger> m_logger; 208 const void* m_logIdentifier; 209 #endif 210 189 211 std::unique_ptr<RtpTransceiverSet> m_transceiverSet { std::unique_ptr<RtpTransceiverSet>(new RtpTransceiverSet()) }; 190 212 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
r219856 r222271 64 64 , m_setRemoteSessionDescriptionObserver(*this) 65 65 , m_statsLogTimer(*this, &LibWebRTCMediaEndpoint::gatherStatsForLogging) 66 #if !RELEASE_LOG_DISABLED 67 , m_logger(peerConnection.logger()) 68 , m_logIdentifier(peerConnection.logIdentifier()) 69 #endif 66 70 { 67 71 ASSERT(client.factory()); … … 1066 1070 void LibWebRTCMediaEndpoint::OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report) 1067 1071 { 1068 if (!m_statsTimestamp) 1069 m_statsTimestamp = report->timestamp_us(); 1070 else if (m_statsLogTimer.repeatInterval() == 2_s && (report->timestamp_us() - m_statsTimestamp) > 15000000) { 1071 callOnMainThread([protectedThis = makeRef(*this)] { 1072 protectedThis->m_statsLogTimer.augmentRepeatInterval(9_s); 1072 #if !RELEASE_LOG_DISABLED 1073 int64_t timestamp = report->timestamp_us(); 1074 if (!m_statsFirstDeliveredTimestamp) 1075 m_statsFirstDeliveredTimestamp = timestamp; 1076 1077 if (m_statsLogTimer.repeatInterval() != statsLogInterval(timestamp)) { 1078 callOnMainThread([protectedThis = makeRef(*this), this, timestamp] { 1079 m_statsLogTimer.stop(); 1080 m_statsLogTimer.startRepeating(statsLogInterval(timestamp)); 1073 1081 }); 1074 1082 } 1075 1083 1076 #if !RELEASE_LOG_DISABLED1077 // Log stats once every second for the 30 seconds, then drop to once every 5 seconds.1078 1084 for (auto iterator = report->begin(); iterator != report->end(); ++iterator) { 1079 1085 if (iterator->type() == webrtc::RTCCodecStats::kType) 1080 1086 continue; 1081 RELEASE_LOG(WebRTC, "WebRTC stats for %p: %{public}s", this, iterator->ToString().c_str()); 1087 1088 ALWAYS_LOG(LOGIDENTIFIER, "WebRTC stats for :", *iterator); 1082 1089 } 1083 1090 #else … … 1091 1098 if (m_statsLogTimer.isActive()) 1092 1099 m_statsLogTimer.stop(); 1093 m_statsLogTimer.startRepeating( 2_s);1100 m_statsLogTimer.startRepeating(statsLogInterval(0)); 1094 1101 #endif 1095 1102 } … … 1100 1107 } 1101 1108 1109 #if !RELEASE_LOG_DISABLED 1110 WTFLogChannel& LibWebRTCMediaEndpoint::logChannel() const 1111 { 1112 return LogWebRTC; 1113 } 1114 1115 Seconds LibWebRTCMediaEndpoint::statsLogInterval(int64_t reportTimestamp) const 1116 { 1117 if (logger().willLog(logChannel(), WTFLogLevelInfo)) 1118 return 2_s; 1119 1120 if (reportTimestamp - m_statsFirstDeliveredTimestamp > 15000000) 1121 return 10_s; 1122 1123 return 4_s; 1124 } 1125 #endif 1126 1102 1127 } // namespace WebCore 1103 1128 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h
r218994 r222271 33 33 #include "RealtimeOutgoingVideoSource.h" 34 34 #include <Timer.h> 35 35 #include <pal/Logger.h> 36 #include <pal/LoggerHelper.h> 36 37 #include <webrtc/api/jsep.h> 37 38 #include <webrtc/api/peerconnectioninterface.h> 38 39 #include <webrtc/pc/peerconnectionfactory.h> 39 40 #include <webrtc/pc/rtcstatscollector.h> 40 41 41 #include <wtf/ThreadSafeRefCounted.h> 42 42 … … 58 58 class RTCSessionDescription; 59 59 60 class LibWebRTCMediaEndpoint : public ThreadSafeRefCounted<LibWebRTCMediaEndpoint>, private webrtc::PeerConnectionObserver, private webrtc::RTCStatsCollectorCallback { 60 class LibWebRTCMediaEndpoint 61 : public ThreadSafeRefCounted<LibWebRTCMediaEndpoint> 62 , private webrtc::PeerConnectionObserver 63 , private webrtc::RTCStatsCollectorCallback 64 #if !RELEASE_LOG_DISABLED 65 , public PAL::LoggerHelper 66 #endif 67 { 61 68 public: 62 69 static Ref<LibWebRTCMediaEndpoint> create(LibWebRTCPeerConnectionBackend& peerConnection, LibWebRTCProvider& client) { return adoptRef(*new LibWebRTCMediaEndpoint(peerConnection, client)); } … … 127 134 bool shouldOfferAllowToReceiveVideo() const; 128 135 136 #if !RELEASE_LOG_DISABLED 137 const PAL::Logger& logger() const final { return m_logger.get(); } 138 const void* logIdentifier() const final { return m_logIdentifier; } 139 const char* logClassName() const final { return "LibWebRTCMediaEndpoint"; } 140 WTFLogChannel& logChannel() const final; 141 142 Seconds statsLogInterval(int64_t) const; 143 #endif 144 129 145 class CreateSessionDescriptionObserver final : public webrtc::CreateSessionDescriptionObserver { 130 146 public: … … 195 211 bool m_isInitiator { false }; 196 212 Timer m_statsLogTimer; 197 int64_t m_statsTimestamp { 0 }; 213 214 #if !RELEASE_LOG_DISABLED 215 int64_t m_statsFirstDeliveredTimestamp { 0 }; 216 Ref<const PAL::Logger> m_logger; 217 const void* m_logIdentifier; 218 #endif 198 219 }; 199 220 200 221 } // namespace WebCore 201 222 223 namespace PAL { 224 225 template<typename Type> 226 struct LogArgument; 227 228 template <> 229 struct LogArgument<webrtc::RTCStats> { 230 static String toString(const webrtc::RTCStats& iterator) 231 { 232 return WTF::String(iterator.ToString().c_str()); 233 } 234 }; 235 236 }; // namespace PAL 237 202 238 #endif // USE(LIBWEBRTC) -
trunk/Source/WebCore/platform/mediastream/RTCIceConnectionState.h
r214212 r222271 39 39 }; 40 40 41 String convertEnumerationToString(RTCIceConnectionState); // in JSCRTCIceConnectionState.cpp 42 41 43 }; // namespace WebCore 42 44 45 namespace PAL { 46 47 template<typename Type> 48 struct LogArgument; 49 50 template <> 51 struct LogArgument<WebCore::RTCIceConnectionState> { 52 static String toString(const WebCore::RTCIceConnectionState state) 53 { 54 return convertEnumerationToString(state); 55 } 56 }; 57 58 }; // namespace PAL 59 43 60 #endif -
trunk/Source/WebCore/platform/mediastream/RTCIceGatheringState.h
r214212 r222271 27 27 #if ENABLE(WEB_RTC) 28 28 29 #include <wtf/text/WTFString.h> 30 29 31 namespace WebCore { 30 32 … … 35 37 }; 36 38 39 String convertEnumerationToString(RTCIceGatheringState); // in JSCRTCIceGatheringState.cpp 40 37 41 }; // namespace WebCore 38 42 43 namespace PAL { 44 45 template<typename Type> 46 struct LogArgument; 47 48 template <> 49 struct LogArgument<WebCore::RTCIceGatheringState> { 50 static String toString(const WebCore::RTCIceGatheringState state) 51 { 52 return convertEnumerationToString(state); 53 } 54 }; 55 56 }; // namespace PAL 57 39 58 #endif -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionState.h
r214293 r222271 38 38 }; 39 39 40 String convertEnumerationToString(RTCPeerConnectionState); // in JSCRTCPeerConnectionState.h 41 40 42 }; // namespace WebCore 41 43 44 namespace PAL { 45 46 template<typename Type> 47 struct LogArgument; 48 49 template <> 50 struct LogArgument<WebCore::RTCPeerConnectionState> { 51 static String toString(const WebCore::RTCPeerConnectionState state) 52 { 53 return convertEnumerationToString(state); 54 } 55 }; 56 57 }; // namespace PAL 58 42 59 #endif -
trunk/Source/WebCore/platform/mediastream/RTCSignalingState.h
r215327 r222271 37 37 }; 38 38 39 String convertEnumerationToString(RTCSignalingState); // in JSCRTCSignalingState.cpp 40 39 41 }; // namespace WebCore 40 42 43 namespace PAL { 44 45 template<typename Type> 46 struct LogArgument; 47 48 template <> 49 struct LogArgument<WebCore::RTCSignalingState> { 50 static String toString(const WebCore::RTCSignalingState state) 51 { 52 return convertEnumerationToString(state); 53 } 54 }; 55 56 }; // namespace PAL 57 41 58 #endif
Note: See TracChangeset
for help on using the changeset viewer.