Changeset 263623 in webkit
- Timestamp:
- Jun 27, 2020 9:20:26 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r263622 r263623 1 2020-06-27 Youenn Fablet <youenn@apple.com> 2 3 Log capture device information in case of getUserMedia failing to select a device 4 https://bugs.webkit.org/show_bug.cgi?id=213643 5 6 Reviewed by Eric Carlson. 7 8 Log constraints and device in case of a failing getUserMedia call. 9 No obserable change, logging addition. 10 11 * platform/mediastream/mac/CoreAudioCaptureDevice.cpp: 12 (WebCore::getDeviceInfo): 13 (WebCore::CoreAudioCaptureDevice::deviceClock): 14 * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: 15 (WebCore::isValidCaptureDevice): 16 * platform/mediastream/MediaConstraints.cpp: 17 (WebCore::MediaConstraint::log const): 18 (WebCore::BooleanConstraint::logAsBoolean const): 19 (WebCore::DoubleConstraint::logAsDouble const): 20 (WebCore::IntConstraint::logAsInt const): 21 * platform/mediastream/MediaConstraints.h: 22 * platform/mediastream/RealtimeMediaSource.cpp: 23 (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): 24 (WebCore::RealtimeMediaSource::selectSettings): 25 * platform/mediastream/RealtimeMediaSourceCenter.cpp: 26 (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): 27 * platform/mediastream/RealtimeVideoCaptureSource.cpp: 28 (WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate): 29 * platform/mediastream/VideoPreset.h: 30 (WebCore::VideoPreset::log const): 31 1 32 2020-06-27 Youenn Fablet <youenn@apple.com> 2 33 -
trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp
r241489 r263623 405 405 addDefaultVideoConstraints(mandatoryConstraints, needsFrameRateConstraints, needsSizeConstraints, needsFacingModeConstraints); 406 406 } 407 407 408 void MediaConstraint::log() const 409 { 410 switch (dataType()) { 411 case DataType::Boolean: 412 downcast<const BooleanConstraint>(*this).logAsBoolean(); 413 break; 414 case DataType::Double: 415 downcast<const DoubleConstraint>(*this).logAsDouble(); 416 break; 417 case DataType::Integer: 418 downcast<const IntConstraint>(*this).logAsInt(); 419 break; 420 case DataType::None: 421 case DataType::String: 422 WTFLogAlways("MediaConstraint %d of type %d", constraintType(), dataType()); 423 } 424 } 425 426 void BooleanConstraint::logAsBoolean() const 427 { 428 WTFLogAlways("BooleanConstraint %d, exact %d, ideal %d", constraintType(), m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1); 429 } 430 431 void DoubleConstraint::logAsDouble() const 432 { 433 WTFLogAlways("DoubleConstraint %d, min %f, max %f, exact %f, ideal %f", constraintType(), m_min ? *m_min : -1, m_max ? *m_max : -1, m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1); 434 } 435 436 void IntConstraint::logAsInt() const 437 { 438 WTFLogAlways("IntConstraint %d, min %d, max %d, exact %d, ideal %d", constraintType(), m_min ? *m_min : -1, m_max ? *m_max : -1, m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1); 439 } 440 441 408 442 } 409 443 -
trunk/Source/WebCore/platform/mediastream/MediaConstraints.h
r262994 r263623 76 76 } 77 77 78 void log() const; 79 78 80 protected: 79 81 MediaConstraint(const String& name, MediaConstraintType constraintType, DataType dataType) … … 416 418 NumericConstraint::innerMerge(downcast<const IntConstraint>(other)); 417 419 } 420 421 void logAsInt() const; 418 422 }; 419 423 … … 432 436 NumericConstraint::innerMerge(downcast<DoubleConstraint>(other)); 433 437 } 438 439 void logAsDouble() const; 434 440 }; 435 441 … … 527 533 return true; 528 534 } 535 536 void logAsBoolean() const; 529 537 530 538 private: -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
r262905 r263623 312 312 double constraintDistance = fitnessDistance(*widthConstraint); 313 313 if (std::isinf(constraintDistance)) { 314 auto range = capabilities.width(); 315 WTFLogAlways("RealtimeMediaSource::supportsSizeAndFrameRate failed width constraint, capabilities are [%d, %d]", range.rangeMin().asInt, range.rangeMax().asInt); 314 316 badConstraint = widthConstraint->name(); 315 317 return false; … … 327 329 double constraintDistance = fitnessDistance(*heightConstraint); 328 330 if (std::isinf(constraintDistance)) { 331 auto range = capabilities.height(); 332 WTFLogAlways("RealtimeMediaSource::supportsSizeAndFrameRate failed height constraint, capabilities are [%d, %d]", range.rangeMin().asInt, range.rangeMax().asInt); 329 333 badConstraint = heightConstraint->name(); 330 334 return false; … … 342 346 double constraintDistance = fitnessDistance(*frameRateConstraint); 343 347 if (std::isinf(constraintDistance)) { 348 auto range = capabilities.frameRate(); 349 WTFLogAlways("RealtimeMediaSource::supportsSizeAndFrameRate failed frame rate constraint, capabilities are [%d, %d]", range.rangeMin().asInt, range.rangeMax().asInt); 344 350 badConstraint = frameRateConstraint->name(); 345 351 return false; … … 662 668 return false; 663 669 664 constraints.mandatoryConstraints.filter([&]( const MediaConstraint& constraint) {670 constraints.mandatoryConstraints.filter([&](auto& constraint) { 665 671 if (!supportsConstraint(constraint)) 666 672 return false; … … 673 679 double constraintDistance = fitnessDistance(constraint); 674 680 if (std::isinf(constraintDistance)) { 681 WTFLogAlways("RealtimeMediaSource::selectSettings failed constraint %d", constraint.constraintType()); 675 682 failedConstraint = constraint.name(); 676 683 return true; -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp
r261373 r263623 247 247 getUserMediaDevices(request, String { deviceIdentifierHashSalt }, audioDeviceInfo, videoDeviceInfo, firstInvalidConstraint); 248 248 249 if ((request.audioConstraints.isValid && audioDeviceInfo.isEmpty()) || (request.videoConstraints.isValid && videoDeviceInfo.isEmpty())) { 249 if (request.audioConstraints.isValid && audioDeviceInfo.isEmpty()) { 250 WTFLogAlways("Audio capture was requested but no device was found amongst %zu devices", audioCaptureFactory().audioCaptureDeviceManager().captureDevices().size()); 251 request.audioConstraints.mandatoryConstraints.forEach([](auto& constraint) { constraint.log(); }); 252 253 invalidHandler(firstInvalidConstraint); 254 return; 255 } 256 257 if (request.videoConstraints.isValid && videoDeviceInfo.isEmpty()) { 258 WTFLogAlways("Video capture was requested but no device was found amongst %zu devices", videoCaptureFactory().videoCaptureDeviceManager().captureDevices().size()); 259 request.videoConstraints.mandatoryConstraints.forEach([](auto& constraint) { constraint.log(); }); 260 250 261 invalidHandler(firstInvalidConstraint); 251 262 return; -
trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp
r260364 r263623 330 330 } 331 331 332 if (!exactSizePreset && !aspectRatioPreset && !resizePreset) 332 if (!exactSizePreset && !aspectRatioPreset && !resizePreset) { 333 WTFLogAlways("RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate failed supporting constraints %d %d %f", requestedWidth ? *requestedWidth : -1, requestedHeight ? *requestedHeight : -1, requestedFrameRate ? *requestedFrameRate : -1); 334 for (const auto& preset : presets()) 335 preset->log(); 336 333 337 return { }; 338 } 334 339 335 340 result.requestedFrameRate = requestedFrameRate.value(); -
trunk/Source/WebCore/platform/mediastream/VideoPreset.h
r244704 r263623 115 115 VideoPresetType type; 116 116 117 void log()const; 118 117 119 protected: 118 120 VideoPreset(IntSize size, Vector<FrameRateRange>&& frameRateRanges, VideoPresetType type) … … 124 126 }; 125 127 128 inline void VideoPreset::log() const 129 { 130 WTFLogAlways("VideoPreset of size (%d,%d) and type %d", size.width(), size.height(), type); 131 for (auto range : frameRateRanges) 132 WTFLogAlways("VideoPreset frame rate range [%f, %f]", range.minimum, range.maximum); 133 } 134 126 135 } // namespace WebCore 127 136 -
trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp
r239427 r263623 46 46 auto err = AudioObjectGetPropertyData(static_cast<UInt32>(deviceID), &address, 0, nullptr, &dataSize, &uniqueID); 47 47 if (err) { 48 LOG(Media, "CoreAudioCaptureDevice::getDeviceInfo failed to get device unique id with error %d (%.4s)", (int)err, (char*)&err);48 RELEASE_LOG_ERROR(WebRTC, "CoreAudioCaptureDevice::getDeviceInfo failed to get device unique id with error %d (%.4s)", (int)err, (char*)&err); 49 49 return false; 50 50 } … … 57 57 err = AudioObjectGetPropertyData(static_cast<UInt32>(deviceID), &address, 0, nullptr, &dataSize, &localizedName); 58 58 if (err) { 59 LOG(Media, "CoreAudioCaptureDevice::getDeviceInfo failed to get device name with error %d (%.4s)", (int)err, (char*)&err);59 RELEASE_LOG_ERROR(WebRTC, "CoreAudioCaptureDevice::getDeviceInfo failed to get device name with error %d (%.4s)", (int)err, (char*)&err); 60 60 return false; 61 61 } … … 90 90 auto err = CMAudioDeviceClockCreate(kCFAllocatorDefault, persistentId().createCFString().get(), &clock); 91 91 if (err) { 92 LOG(Media, "CoreAudioCaptureDevice::CMAudioDeviceClockCreate(%p) CMAudioDeviceClockCreate failed with error %d (%.4s)", this, (int)err, (char*)&err);92 RELEASE_LOG_ERROR(WebRTC, "CoreAudioCaptureDevice::CMAudioDeviceClockCreate(%p) CMAudioDeviceClockCreate failed with error %d (%.4s)", this, (int)err, (char*)&err); 93 93 return nullptr; 94 94 } -
trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp
r258478 r263623 85 85 // Ignore output devices that have input only for echo cancellation. 86 86 AudioObjectPropertyAddress address = { kAudioDevicePropertyTapEnabled, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster }; 87 if (AudioObjectHasProperty(device.deviceID(), &address)) 88 return false; 87 if (AudioObjectHasProperty(device.deviceID(), &address)) { 88 RELEASE_LOG(WebRTC, "Ignoring output device that have input only for echo cancellation"); 89 return false; 90 } 89 91 90 92 // Ignore non-aggregable devices. … … 97 99 if (name) 98 100 CFRelease(name); 99 if (isNonAggregable) 100 return false; 101 if (isNonAggregable) { 102 RELEASE_LOG(WebRTC, "Ignoring output device that is non aggregable"); 103 return false; 104 } 101 105 102 106 // Ignore unnamed devices and aggregate devices created by VPIO. 103 return !device.label().isEmpty() && !device.label().startsWith("VPAUAggregateAudioDevice"); 107 if (device.label().isEmpty()) { 108 RELEASE_LOG(WebRTC, "Ignoring output device that is unnamed"); 109 return false; 110 } 111 112 if (device.label().startsWith("VPAUAggregateAudioDevice")) { 113 RELEASE_LOG(WebRTC, "Ignoring output VPAUAggregateAudioDevice device"); 114 return false; 115 } 116 117 return true; 104 118 } 105 119
Note: See TracChangeset
for help on using the changeset viewer.