Implement media track capabilities and interop marshaling#70
Merged
Conversation
…marshalling - Add VideoFacingModeValue and VideoResizeModeValue wrapper types (VideoModeValues.cs) for extensible string-domain constraints; replace raw VideoFacingModes/VideoResizeModes enums in MediaTrackCapabilities, MediaTrackSettings, and MediaTrackConstraintSet - Implement full constraint marshalling in MarshalMediaConstraints.h: native structs (MediaTrackConstraintSet, MediaTrackConstraints) and marshal_as<> specializations covering all constrainable properties - Expand MarshalMedia.h with VideoFacingModeValue and VideoResizeModeValue marshal_as<> specializations; refactor existing media marshalling - Remove reflection-based Create() calls in MediaStreamTrack.cpp; call MediaTrackCapabilities::Create and MediaTrackSettings::Create directly via InternalsVisibleTo - Add/expand unit tests for constraint types and unsigned numeric constraint marshalling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Func<MediaTrackCapabilities>? delegate to InputDeviceInfo; set at device enumeration time, invoked lazily in GetCapabilities() - VideoCapabilityQuery: DirectShow width/height/frameRate/aspectRatio, ResizeMode, FacingMode (via Media Foundation); split to own files - AudioCapabilityQuery: WASAPI sampleRate/sampleSize/channelCount; hardcode autoGainControl and noiseSuppression as [true, false] per WebRTC APM (mirrors Blink input_device_info.cc); echoCancellation reports [Software, false] always -- System mode added later once WASAPI device effects are queried - Remove reflection from MediaStreamTrack.cpp; use direct Create() calls - MarshalMediaTrackCapabilities.h: remove stale DoubleRange/IntRange specs - MediaTrackCapabilities.Create/CreateIdentity made public for C++/CLI ([EditorBrowsable(Never)] hides from IDE); same for MediaTrackSettings - Rename EchoCancellationMode: All/RemoteOnly -> System/Software 'software' = WebRTC AEC3 in app layer (raw WASAPI, always available) 'system' = OS/driver AEC (default WASAPI mode, device-dependent) boolean true = attempt System first, fall back to Software - Update marshaling maps, C++/CLI tests, and managed tests accordingly - Add unit tests for delegate and fallback paths (118 tests pass) Closes #59 Related to #58 (GetSupportedConstraints -- now has data to aggregate) Related to #51 and #68 (capability data is a prerequisite for both) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- AudioCapabilityQuery: replace silent FAILED() checks with
InteropHResult::LogIfFailed for COM init, device lookup, IAudioClient
activation, and GetMixFormat; add trace log with mix format details
- VideoCapabilityQuery: replace silent FAILED() checks with
InteropHResult::LogIfFailed for MFStartup, MFCreateAttributes,
SetGUID, MFEnumDeviceSources, and symbolic link lookup; add trace
log with DirectShow capability count and facing mode result
- Add WebRtcLogEventId.AudioCapabilityQueryCompleted (2004) and
VideoCapabilityQueryCompleted (2005) for structured log filtering
- Restore accidentally removed #include <winerror.h> in InteropHResult.h
- EchoCancellationMode: All/RemoteOnly -> System/Software; update
serialized strings ('system'/'software'), marshaling maps, and tests
- EchoCancellationValue(bool): document that true attempts System first,
falls back to Software
Closes #50
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements media track capability/settings parity across managed and interop layers, including marshaling updates and
InputDeviceInfo.GetCapabilities()support. Also adds diagnostics around capability queries and expands managed/native tests for the new capability and constraint behavior.Change Area (required)
WebRtcNet.Api/ managed-only behavior)Required Evidence (for behavioral/API changes)
1) W3C reference (required when applicable)
MediaTrackCapabilitiesandMediaTrackSettingsare dictionary snapshots used to expose supported ranges/options and current settings for tracks/devices.InputDeviceInfo.getCapabilities()exposes source capabilities as aMediaTrackCapabilities-shaped object.2) Google source reference (required when applicable)
Provide pinned references: path + revision context (commit SHA or branch/tag).
api/media_stream_interface.hapi/media_stream_track.hmodules/audio_processing/include/audio_processing.hbranch-heads/7778(repo artifact baseline used by this repository)3) Intended observable behavior (required when applicable)
Describe externally observable behavior (state transitions, event ordering, timing, errors).
MediaTrackCapabilities/MediaTrackSettingsand constraints now map sequence/scalar/nullability behavior consistently across managed and interop boundaries.InputDeviceInfo.GetCapabilities()now returns populated capability information through interop rather than a placeholder/non-functional path.4) Divergence from Google reference (required if diverging)
Test Evidence (required)
Tests added/updated
WebRtcInterop.UnitTests/Marshaling/MarshalMediaTests.cppWebRtcNet.Api.UnitTests/MediaTrackConstraintTests.csWebRtcNet.Api.UnitTests/MediaTrackUnsignedNumericTypesTests.csCommands run + results
dotnet test WebRtcNet.Api.UnitTests\WebRtcNet.Api.UnitTests.csproj-> Passed (110/110 onnet10.0-windows, 110/110 onnet48)"C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\amd64\MSBuild.exe" WebRtcInterop.UnitTests\WebRtcInterop.UnitTests.vcxproj -p:Configuration=Debug -p:Platform=x64 -nologo-> SucceededWebRtcInterop.UnitTests\bin\x64\Debug\v4.8\WebRtcInterop.UnitTests.exe-> Passed (58/58)Change-area test gate confirmation
If environment unavailable (required when checked above)
Documentation
Spec/Crosswalk Review (required for W3C-aligned behavior changes)
docs\standards\crosswalk\webrtcnet-api-to-spec.mddocs\standards\specs\index\spec-map.md.\scripts\update-spec-docs.ps1) when needed