From: Haesu Gwon Date: Thu, 18 Jul 2024 02:12:19 +0000 (+0900) Subject: [WebRTC] Change state restriction (#6181) X-Git-Tag: submit/tizen/20240718.150959~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d5a357f116fdb40be652c895735dbfc3f92a34b;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [WebRTC] Change state restriction (#6181) * [WebRTC] Change state restriction --- diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs index 4592109..40e6ea3 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs @@ -107,15 +107,11 @@ namespace Tizen.Multimedia.Remoting /// Sets the transceiver direction for receiving media stream. /// /// - /// The WebRTC must be in the state when transceiver direction is set. + /// This method does not throw state exception anymore(Since API Leve 12). It can be called in any state.
///
/// The media type. /// The transceiver direction. - /// - /// MediaSource is not attached yet.
- /// -or-
- /// The WebRTC is not in the valid state. - ///
+ /// MediaSource is not attached yet. /// The WebRTC has already been disposed. /// 10 public void SetTransceiverDirection(MediaType type, TransceiverDirection direction) diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaMicrophoneSource.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaMicrophoneSource.cs index d4cd5d0..8823ef8 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaMicrophoneSource.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaMicrophoneSource.cs @@ -66,8 +66,7 @@ namespace Tizen.Multimedia.Remoting /// /// The to apply. /// - /// The WebRTC must be in the state.
- ///
+ /// This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
/// does not support all .
/// Supported types are , , /// , . @@ -77,7 +76,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// has already been disposed. /// - /// The WebRTC is not in the valid state. + /// An internal error occurs. /// is null. /// /// of is not supported on the current platform. @@ -91,8 +90,6 @@ namespace Tizen.Multimedia.Remoting throw new ArgumentNullException(nameof(policy), "policy is null"); } - WebRtc.ValidateWebRTCState(WebRTCState.Idle); - var ret = NativeWebRTC.SetAudioStreamPolicyToMicrophoneSource(WebRtc.Handle, SourceId.Value, policy.Handle); if (ret == WebRTCErrorCode.InvalidArgument) diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaNullSource.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaNullSource.cs index c685439..cdd1d34 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaNullSource.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaNullSource.cs @@ -64,16 +64,11 @@ namespace Tizen.Multimedia.Remoting /// Sets the transceiver codec for receiving media stream. /// /// - /// The WebRTC must be in the state when transceiver codec is set.
- /// + /// This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
///
/// The media type. /// The transceiver codec. - /// - /// MediaSource is not attached yet.
- /// -or-
- /// The WebRTC is not in the valid state. - ///
+ /// MediaSource is not attached yet. /// The WebRTC has already been disposed. /// /// 10 @@ -84,8 +79,6 @@ namespace Tizen.Multimedia.Remoting throw new InvalidOperationException("MediaSource is not attached yet. Call AddSource() first."); } - WebRtc.ValidateWebRTCState(WebRTCState.Idle); - NativeWebRTC.SetTransceiverCodec(WebRtc.Handle, SourceId.Value, type, codec). ThrowIfFailed("Failed to set transceiver codec"); } diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs index 7564e86..b7dc62b 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs @@ -226,7 +226,9 @@ namespace Tizen.Multimedia.Remoting /// /// Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer. /// - /// The WebRTC must be in the + /// + /// The WebRTC must be in the or (Since API Level 12) + /// /// The SDP offer. /// The WebRTC is not in the valid state. /// The WebRTC has already been disposed. @@ -234,7 +236,7 @@ namespace Tizen.Multimedia.Remoting /// 9 public async Task CreateOfferAsync() { - ValidateWebRTCState(WebRTCState.Negotiating); + ValidateWebRTCState(WebRTCState.Negotiating, WebRTCState.Playing); var tcsSdpCreated = new TaskCompletionSource(); @@ -259,7 +261,9 @@ namespace Tizen.Multimedia.Remoting /// /// Creates SDP answer asynchronously with option to an offer received from a remote peer. /// - /// The WebRTC must be in the + /// + /// The WebRTC must be in the or (Since API Level 12) + /// /// The SDP answer. /// The WebRTC is not in the valid state. /// The WebRTC has already been disposed. @@ -267,7 +271,7 @@ namespace Tizen.Multimedia.Remoting /// 9 public async Task CreateAnswerAsync() { - ValidateWebRTCState(WebRTCState.Negotiating); + ValidateWebRTCState(WebRTCState.Negotiating, WebRTCState.Playing); var tcsSdpCreated = new TaskCompletionSource(); @@ -292,7 +296,9 @@ namespace Tizen.Multimedia.Remoting /// /// Sets the session description for a local peer. /// - /// The WebRTC must be in the . + /// + /// The WebRTC must be in the or (Since API Level 12) + /// /// The local session description. /// The description is empty string. /// The description is null. @@ -303,7 +309,7 @@ namespace Tizen.Multimedia.Remoting /// 9 public void SetLocalDescription(string description) { - ValidateWebRTCState(WebRTCState.Negotiating); + ValidateWebRTCState(WebRTCState.Negotiating, WebRTCState.Playing); ValidationUtil.ValidateIsNullOrEmpty(description, nameof(description)); @@ -313,7 +319,9 @@ namespace Tizen.Multimedia.Remoting /// /// Sets the session description of the remote peer's current offer or answer. /// - /// The WebRTC must be in the . + /// + /// The WebRTC must be in the or (Since API Level 12) + /// /// The remote session description. /// The description is empty string. /// The description is null. @@ -324,7 +332,7 @@ namespace Tizen.Multimedia.Remoting /// 9 public void SetRemoteDescription(string description) { - ValidateWebRTCState(WebRTCState.Negotiating); + ValidateWebRTCState(WebRTCState.Negotiating, WebRTCState.Playing); ValidationUtil.ValidateIsNullOrEmpty(description, nameof(description)); @@ -378,7 +386,7 @@ namespace Tizen.Multimedia.Remoting /// Adds media source. /// /// - /// The WebRTC must be in the .
+ /// This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
/// Each MediaSource requires different feature or privilege.
/// needs camera feature and privilege.
/// needs microphone feature and recorder privilege.
@@ -393,7 +401,7 @@ namespace Tizen.Multimedia.Remoting /// http://tizen.org/privilege/recorder /// The media source is null. /// - /// The WebRTC is not in the valid state.
+ /// An internal error occurs.
/// - or -
/// All or one of was already detached. ///
@@ -415,8 +423,6 @@ namespace Tizen.Multimedia.Remoting throw new ArgumentNullException(nameof(source), "source is null"); } - ValidateWebRTCState(WebRTCState.Idle); - source?.AttachTo(this); _source.Add(source); @@ -426,7 +432,7 @@ namespace Tizen.Multimedia.Remoting /// Adds media sources. /// /// - /// The WebRTC must be in the .
+ /// This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
/// Each MediaSource requires different feature or privilege.
/// needs camera feature and privilege.
/// needs microphone feature and recorder privilege.
@@ -441,7 +447,7 @@ namespace Tizen.Multimedia.Remoting /// http://tizen.org/privilege/recorder /// The media source is null. /// - /// The WebRTC is not in the valid state.
+ /// An internal error occurs.
/// - or -
/// All or one of was already detached. ///
@@ -473,12 +479,12 @@ namespace Tizen.Multimedia.Remoting /// Removes media source. /// /// - /// The WebRTC must be in the .
+ /// This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
/// If user want to use removed MediaSource again, user should create new instance for it. ///
/// The media source to remove. /// The media source is null. - /// The WebRTC is not in the valid state. + /// An internal error occurs. /// The WebRTC has already been disposed. /// /// @@ -495,8 +501,6 @@ namespace Tizen.Multimedia.Remoting throw new ArgumentNullException(nameof(source), "source is null"); } - ValidateWebRTCState(WebRTCState.Idle); - source?.DetachFrom(this); _source.Remove(source); @@ -508,12 +512,12 @@ namespace Tizen.Multimedia.Remoting /// Removes media sources. /// /// - /// The WebRTC must be in the .
+ /// This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
/// If user want to use removed MediaSource again, user should create new instance for it. ///
/// The media source to remove. /// The media source is null. - /// The WebRTC is not in the valid state. + /// An internal error occurs. /// The WebRTC has already been disposed. /// /// @@ -601,7 +605,9 @@ namespace Tizen.Multimedia.Remoting /// /// Retrieves the current statistics information. /// - /// The WebRTC must be in the + /// + /// The WebRTC must be in the (Since API Level 12) or + /// /// The WebRTC statistics informations. /// The category of statistics to get. /// The WebRTC has already been disposed. @@ -609,7 +615,7 @@ namespace Tizen.Multimedia.Remoting /// 10 public ReadOnlyCollection GetStatistics(WebRTCStatisticsCategory category) { - ValidateWebRTCState(WebRTCState.Playing); + ValidateWebRTCState(WebRTCState.Negotiating, WebRTCState.Playing); var stats = new List(); Exception caught = null;