From e486384fbdc23b5226766d780e66eacd602e116d Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Wed, 9 Aug 2023 10:55:24 +0900 Subject: [PATCH] [WebRTC] Add display feature for video APIs (#5442) --- .../WebRTC/MediaScreenSource.cs | 5 +++ .../WebRTC/MediaSource.cs | 6 ++++ .../WebRTC/MediaStreamTrack.cs | 41 +++++++++++++++++++++- src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs | 2 ++ .../WebRTC/WebRTCFeatures.cs | 1 + 5 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaScreenSource.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaScreenSource.cs index 7be1574..391a13a 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaScreenSource.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaScreenSource.cs @@ -34,6 +34,11 @@ namespace Tizen.Multimedia.Remoting /// /// Initializes a new instance of the class. /// + /// http://tizen.org/feature/display + /// + /// If display feature is not supported, NotSupportedException will be thrown + /// when MediaScreenSource is added by or . + /// /// 9 public MediaScreenSource() : base(MediaType.Video) {} diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaSource.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaSource.cs index a4a2306..7768f69 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaSource.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaSource.cs @@ -615,6 +615,8 @@ namespace Tizen.Multimedia.Remoting /// Enables the video loopback. The local video will be diaplayed in . /// /// The to apply. + /// http://tizen.org/feature/display + /// The required feature is not supported. /// The display has already been assigned to another. /// is null. /// @@ -628,6 +630,10 @@ namespace Tizen.Multimedia.Remoting { uint trackId = 0; + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } if (!SourceId.HasValue) { throw new InvalidOperationException("MediaSource is not attached yet. Call AddSource() first."); diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs b/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs index 3862f67..1d154e9 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs @@ -64,6 +64,8 @@ namespace Tizen.Multimedia.Remoting /// If remote track, must be set in event.
/// The display is created with . /// + /// http://tizen.org/feature/display + /// The required feature is not supported. /// The WebRTC has already been disposed of. /// The value has already been assigned to another WebRTC. /// @@ -74,9 +76,22 @@ namespace Tizen.Multimedia.Remoting /// 9 public Display Display { - get => _display; + get + { + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } + + return _display; + } set { + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } + if (Type != MediaType.Video) { throw new InvalidOperationException("This property is only for video track."); @@ -122,6 +137,8 @@ namespace Tizen.Multimedia.Remoting /// /// This property is meaningful only in overlay or EVAS surface display type. /// + /// http://tizen.org/feature/display + /// The required feature is not supported. /// A that specifies the display mode. /// Display mode type is incorrect. /// is not set. @@ -130,6 +147,11 @@ namespace Tizen.Multimedia.Remoting { get { + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } + if (Type != MediaType.Video) { throw new InvalidOperationException("This property is only for video track."); @@ -142,6 +164,11 @@ namespace Tizen.Multimedia.Remoting } set { + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } + if (Type != MediaType.Video) { throw new InvalidOperationException("This property is only for video track."); @@ -161,12 +188,19 @@ namespace Tizen.Multimedia.Remoting /// /// This property is meaningful only in overlay or EVAS surface display type. /// + /// http://tizen.org/feature/display + /// The required feature is not supported. /// is not set. /// 9 public bool DisplayVisible { get { + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } + if (Type != MediaType.Video) { throw new InvalidOperationException("This property is only for video track."); @@ -179,6 +213,11 @@ namespace Tizen.Multimedia.Remoting } set { + if (!Features.IsSupported(WebRTCFeatures.Display)) + { + throw new NotSupportedException("Display feature is not supported."); + } + if (Type != MediaType.Video) { throw new InvalidOperationException("This property is only for video track."); diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs index dd6ecff..7564e86 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs @@ -386,6 +386,7 @@ namespace Tizen.Multimedia.Remoting /// The media sources to add. /// http://tizen.org/feature/camera /// http://tizen.org/feature/microphone + /// http://tizen.org/feature/display /// http://tizen.org/privilege/camera /// http://tizen.org/privilege/mediastorage /// http://tizen.org/privilege/externalstorage @@ -433,6 +434,7 @@ namespace Tizen.Multimedia.Remoting /// The media sources to add. /// http://tizen.org/feature/camera /// http://tizen.org/feature/microphone + /// http://tizen.org/feature/display /// http://tizen.org/privilege/camera /// http://tizen.org/privilege/mediastorage /// http://tizen.org/privilege/externalstorage diff --git a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCFeatures.cs b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCFeatures.cs index b10644c..56c772d 100755 --- a/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCFeatures.cs +++ b/src/Tizen.Multimedia.Remoting/WebRTC/WebRTCFeatures.cs @@ -21,5 +21,6 @@ namespace Tizen.Multimedia.Remoting internal const string Wifi = "http://tizen.org/feature/network.wifi"; internal const string Telephony = "http://tizen.org/feature/network.telephony"; internal const string Ethernet = "http://tizen.org/feature/network.ethernet"; + internal const string Display = "http://tizen.org/feature/display"; } } -- 2.7.4