Skip to content

Commit 10b2931

Browse files
author
Juhi Shah
committed
Update C++ code snippet
1 parent ae3ea18 commit 10b2931

File tree

1 file changed

+53
-61
lines changed

1 file changed

+53
-61
lines changed

specs/WebRtcPortConfiguration.md

Lines changed: 53 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -122,73 +122,65 @@ class ScenarioWebRtcUdpPortConfiguration
122122
# API Details
123123
## C++
124124
```
125-
/// Specifies the WebRTC protocol type for port range configuration.
126-
[ms_owner("core", "juhishah@microsoft.com")]
127-
enum CoreWebView2WebRtcProtocolKind
128-
{
129-
/// UDP protocol for WebRTC media and ICE candidates.
130-
Udp = 0,
131-
};
132-
[availability("staging")]
133-
runtimeclass CoreWebView2WebRtcPortConfiguration : [default] ICoreWebView2WebRtcPortConfiguration{}
125+
/// Additional options used to create WebView2 Environment to manage WebRTC UDP port range configuration.
126+
[uuid(0eebe393-8dcf-5bc5-a15d-d862088242e9), object, pointer_default(unique)]
127+
interface ICoreWebView2StagingEnvironmentOptions10 : IUnknown {
128+
/// Get the WebRTC port range configuration object for configuring a custom port range.
129+
/// This configuration object can be used to set and retrieve port range configuration
130+
/// that WebRTC will use for ICE candidates and media connections.
131+
/// If no custom range is configured, WebRTC will use the operating system's default dynamic port range.
132+
/// Configuration must be completed before the environment is created. Once the environment is
133+
/// created, the port range cannot be customized.
134+
///
135+
///
136+
/// \snippet AppWindow.cpp WebRtcPortConfiguration
137+
[propget] HRESULT WebRtcPortConfiguration([out, retval] ICoreWebView2StagingWebRtcPortConfiguration** value);
138+
139+
140+
141+
}
134142
135-
/// <com>
136143
/// WebRTC port configuration interface for managing WebRTC port range configuration.
137144
/// This interface provides methods to configure and retrieve custom port ranges
138145
/// that WebRTC will use for ICE candidates and media connections across different protocols.
139-
/// </com>
140-
[availability("staging")]
141-
[com_interface("staging=ICoreWebView2StagingWebRtcPortConfiguration")]
142-
[ms_owner("core", "juhishah@microsoft.com")]
143-
interface ICoreWebView2WebRtcPortConfiguration
144-
{
145-
// ICoreWebView2StagingWebRtcPortConfiguration members
146-
/// The `SetPortRange` method allows you to set a custom port range for WebRTC to use
147-
/// for a specific protocol type.
148-
/// This method allows configuring a specific port range that WebRTC will use
149-
/// for ICE candidates and media connections for the specified protocol.
150-
///
151-
/// `protocol` specifies the WebRTC protocol type (UDP, TCP, etc.).
152-
/// `minPort` and `maxPort` must be in the range 1025-65535 (inclusive).
153-
/// `minPort` must be less than or equal to `maxPort`.
154-
/// If `minPort` equals `maxPort`, it represents a single port.
155-
///
156-
/// Calling this method will replace any previously configured port range for the specified protocol.
157-
/// <com>
158-
/// \snippet AppWindow.cpp WebRtcPortConfiguration
159-
/// </com>
160-
void SetPortRange(CoreWebView2WebRtcProtocolKind protocol, UInt32 minPort, UInt32 maxPort);
146+
[uuid(b1ac2eb4-15b5-574f-aeb7-c51b9f1520fa), object, pointer_default(unique)]
147+
interface ICoreWebView2StagingWebRtcPortConfiguration : IUnknown {
148+
/// The `SetPortRange` method allows you to set a custom port range for WebRTC to use
149+
/// for a specific protocol type.
150+
/// This method allows configuring a specific port range that WebRTC will use
151+
/// for ICE candidates and media connections for the specified protocol.
152+
///
153+
/// `protocol` specifies the WebRTC protocol type (UDP, TCP, etc.).
154+
/// `minPort` and `maxPort` must be in the range 1025-65535 (inclusive).
155+
/// Calls with invalid ranges return E_INVALIDARG.
156+
/// `minPort` must be less than or equal to `maxPort`.
157+
/// If `minPort` equals `maxPort`, it represents a single port.
158+
///
159+
/// Calling this method will replace any previously configured port range for the specified protocol.
160+
///
161+
///
162+
/// \snippet AppWindow.cpp WebRtcPortConfiguration
163+
HRESULT SetPortRange(
164+
[in] COREWEBVIEW2_WEB_RTC_PROTOCOL_KIND protocol,
165+
[in] UINT32 minPort,
166+
[in] UINT32 maxPort
167+
);
168+
169+
/// The `GetPortRange` method gets the currently configured port range for a specific protocol.
170+
/// Returns TRUE if a custom port range is configured for the specified protocol,
171+
/// with the range values in out parameters.
172+
/// Returns FALSE if no custom range is set for the protocol (using default dynamic allocation),
173+
/// in which case the out parameter values should be ignored.
174+
///
175+
///
176+
/// \snippet AppWindow.cpp WebRtcPortConfiguration
177+
HRESULT GetPortRange(
178+
[in] COREWEBVIEW2_WEB_RTC_PROTOCOL_KIND protocol,
179+
[out] UINT32* minPort,
180+
[out] UINT32* maxPort
181+
, [out, retval] BOOL* value);
161182
162-
/// The `GetPortRange` method gets the currently configured port range for a specific protocol.
163-
/// Returns TRUE if a custom port range is configured for the specified protocol,
164-
/// with the range values in out parameters.
165-
/// Returns FALSE if no custom range is set for the protocol (using default dynamic allocation),
166-
/// in which case the out parameter values should be ignored.
167-
/// <com>
168-
/// \snippet AppWindow.cpp WebRtcPortConfiguration
169-
/// </com>
170-
Boolean GetPortRange(CoreWebView2WebRtcProtocolKind protocol, out UInt32 minPort, out UInt32 maxPort);
171-
}
172-
```
173183
174-
```
175-
/// <com>
176-
/// Additional options used to create WebView2 Environment to manage WebRTC UDP port range configuration.
177-
/// </com>
178-
[availability("staging")]
179-
[com_interface("staging=ICoreWebView2StagingEnvironmentOptions10")]
180-
[ms_owner("core", "juhishah@microsoft.com")]
181-
[exclusiveto(CoreWebView2EnvironmentOptions)]
182-
interface ICoreWebView2StagingEnvironmentOptions10
183-
{
184-
// ICoreWebView2StagingEnvironmentOptions10 members
185-
/// Gets the WebRTC UDP port allocator for configuring a custom UDP port range.
186-
/// This allocator can be used to set and retrieve UDP port range configuration
187-
/// that WebRTC will use for ICE candidates and media connections.
188-
/// <com>
189-
/// \snippet AppWindow.cpp WebRtcPortConfiguration
190-
/// </com>
191-
ICoreWebView2WebRtcPortConfiguration WebRtcPortConfiguration { get; };
192184
}
193185
```
194186

0 commit comments

Comments
 (0)