From 0e4ed552eda064069a4c8597730c83cc414de799 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Mon, 13 Sep 2021 15:03:07 +0900 Subject: [PATCH] [WebRTC] Fix bugs (#3526) * [WebRTC] Fix bugs ans Change MediaFileSource to internal API --- .../WebRTC/MediaFileSource.cs | 3 ++ .../WebRTC/MediaStreamTrack.cs | 17 ++++++- src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs | 58 +++------------------- .../WebRTC/WebRTCDataChannel.cs | 3 +- 4 files changed, 26 insertions(+), 55 deletions(-) diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs index 42db970..10933f9 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaFileSource.cs @@ -15,6 +15,7 @@ */ using System; +using System.ComponentModel; using System.Diagnostics; using NativeWebRTC = Interop.NativeWebRTC; @@ -30,6 +31,7 @@ namespace Tizen.Multimedia.Remoting /// /// /// 9 + [EditorBrowsable(EditorBrowsableState.Never)] public sealed class MediaFileSource : MediaSource { private string _path; @@ -41,6 +43,7 @@ namespace Tizen.Multimedia.Remoting /// The file path. /// is null. /// 9 + [EditorBrowsable(EditorBrowsableState.Never)] public MediaFileSource(MediaType type, string path) : base(type) { _path = path ?? throw new ArgumentNullException(nameof(path), "path is null"); diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs index 688d752..de9a226 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs @@ -67,13 +67,22 @@ namespace Tizen.Multimedia.Remoting /// /// The WebRTC has already been disposed of. /// The value has already been assigned to another WebRTC. - /// The WebRTC is not called in event. + /// + /// The WebRTC is not called in event. + /// -or-
+ /// This MediaStreamTrack is not Video. + ///
/// 9 public Display Display { get => _display; set { + if (Type != MediaType.Video) + { + throw new InvalidOperationException("This property is only for video."); + } + if (value == null) { throw new ArgumentNullException(nameof(value), "Display cannot be null."); @@ -116,6 +125,7 @@ namespace Tizen.Multimedia.Remoting /// /// A that specifies the display mode. /// Display mode type is incorrect. + /// is not set. /// 9 public WebRTCDisplayMode DisplayMode { @@ -142,12 +152,13 @@ namespace Tizen.Multimedia.Remoting /// /// This property is meaningful only in overlay or EVAS surface display type. /// + /// is not set. /// 9 public bool DisplayVisible { get { - NativeWebRTC.GetDisplayVisible(_webRtc.Handle, _trackId,out bool val). + NativeWebRTC.GetDisplayVisible(_webRtc.Handle, _trackId, out bool val). ThrowIfFailed("Failed to get visible status"); return val; @@ -175,6 +186,8 @@ namespace Tizen.Multimedia.Remoting /// was set.
/// -or-
/// This method was not called in event. + /// -or-
+ /// This MediaStreamTrack is not Audio. /// /// /// of is not supported on the current platform. diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs index b4fd253..b077eb3 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs @@ -88,7 +88,6 @@ namespace Tizen.Multimedia.Remoting /// /// Releases all resources used by the current instance. /// - /// The WebRTC has already been disposed. /// 9 public void Dispose() { @@ -130,7 +129,6 @@ namespace Tizen.Multimedia.Remoting if (_handle != null) { - UnregisterEvents(); _handle.Dispose(); _disposed = true; } @@ -231,32 +229,13 @@ namespace Tizen.Multimedia.Remoting } /// - /// Creates SDP offer to start a new WebRTC connection to a remote peer. - /// - /// The WebRTC must be in the - /// The SDP offer. - /// The WebRTC is not in the valid state. - /// The WebRTC has already been disposed. - /// - /// 9 - public string CreateOffer() - { - ValidateWebRTCState(WebRTCState.Negotiating); - - NativeWebRTC.CreateSDPOffer(Handle, new SafeBundleHandle(), out string offer). - ThrowIfFailed("Failed to create offer"); - - return offer; - } - - /// /// Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer. /// /// The WebRTC must be in the /// The SDP offer. /// The WebRTC is not in the valid state. /// The WebRTC has already been disposed. - /// + /// /// 9 public async Task CreateOfferAsync() { @@ -279,36 +258,13 @@ namespace Tizen.Multimedia.Remoting } /// - /// Creates SDP answer to an offer received from a remote peer. - /// - /// - /// The WebRTC must be in the .
- /// The SDP offer must be set by before creating answer. - ///
- /// The SDP answer. - /// The WebRTC is not in the valid state. - /// The WebRTC has already been disposed. - /// - /// - /// 9 - public string CreateAnswer() - { - ValidateWebRTCState(WebRTCState.Negotiating); - - NativeWebRTC.CreateSDPAnswer(Handle, new SafeBundleHandle(), out string answer). - ThrowIfFailed("Failed to create answer"); - - return answer; - } - - /// /// Creates SDP answer asynchronously with option to an offer received from a remote peer. /// /// The WebRTC must be in the /// The SDP answer. /// The WebRTC is not in the valid state. /// The WebRTC has already been disposed. - /// + /// /// 9 public async Task CreateAnswerAsync() { @@ -339,8 +295,8 @@ namespace Tizen.Multimedia.Remoting /// The description is null. /// The WebRTC is not in the valid state. /// The WebRTC has already been disposed. - /// - /// + /// + /// /// 9 public void SetLocalDescription(string description) { @@ -360,8 +316,8 @@ namespace Tizen.Multimedia.Remoting /// The description is null. /// The WebRTC is not in the valid state. /// The WebRTC has already been disposed. - /// - /// + /// + /// /// 9 public void SetRemoteDescription(string description) { @@ -422,7 +378,6 @@ namespace Tizen.Multimedia.Remoting /// The WebRTC must be in the .
/// Each MediaSource requires different feature or privilege.
/// needs camera feature and privilege.
- /// needs mediastorage or externalstorage privilege.
/// needs microphone feature and recorder privilege.
/// /// The media sources to add. @@ -470,7 +425,6 @@ namespace Tizen.Multimedia.Remoting /// The WebRTC must be in the .
/// Each MediaSource requires different feature or privilege.
/// needs camera feature and privilege.
- /// needs mediastorage or externalstorage privilege.
/// needs microphone feature and recorder privilege.
/// /// The media sources to add. diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCDataChannel.cs b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCDataChannel.cs index 3a8a5c9..df8eb66 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCDataChannel.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCDataChannel.cs @@ -122,6 +122,7 @@ namespace Tizen.Multimedia.Remoting /// Sends a string data across the data channel to the remote peer. /// /// The string data to send + /// The WebRTCDataChannel has already been disposed. /// 9 public void Send(string data) { @@ -135,6 +136,7 @@ namespace Tizen.Multimedia.Remoting /// Sends byte data across the data channel to the remote peer. /// /// The byte data to send + /// The WebRTCDataChannel has already been disposed. /// 9 public void Send(byte[] data) { @@ -155,7 +157,6 @@ namespace Tizen.Multimedia.Remoting /// /// Releases all resources used by the current instance. /// - /// The WebRTC has already been disposed. /// 9 public void Dispose() { -- 2.7.4