From: Sangchul Lee Date: Fri, 7 Jul 2023 10:19:10 +0000 (+0900) Subject: Apply display feature X-Git-Tag: accepted/tizen/unified/20230718.162206^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65b1f54d3b206ea7571a80ad5a1f3d44554b51a7;p=platform%2Fcore%2Fapi%2Fwebrtc.git Apply display feature Some functions are not supported on the binary for the headed device. Without this feature, these will return NOT SUPPORTED error. [Version] 0.4.15 [Issue Type] Feature Change-Id: I8344c964244f79f78e8864c1f18ae815d903a9f6 Signed-off-by: Sangchul Lee --- diff --git a/doc/webrtc_doc.h b/doc/webrtc_doc.h index a111e4bb..afbdb5ce 100644 --- a/doc/webrtc_doc.h +++ b/doc/webrtc_doc.h @@ -198,6 +198,7 @@ * This API is related with the following features:\n * - %http://tizen.org/feature/microphone\n * - %http://tizen.org/feature/camera + * - %http://tizen.org/feature/display (Since 8.0) * * It is recommended to design feature related codes in your application for reliability.\n * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n @@ -220,6 +221,15 @@ * - choose not to render the audio or video stream itself but forward it via the callback function with media packet * - enable loopback rendering of the media sources * + * @section CAPI_MEDIA_WEBRTC_MEDIA_RENDER_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - %http://tizen.org/feature/display (Since 8.0) + * + * It is recommended to design feature related codes in your application for reliability.\n + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * More details on featuring your application can be found from Feature Element. + * */ /** diff --git a/include/webrtc.h b/include/webrtc.h index 7aec2e44..0b32056a 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -1037,7 +1037,8 @@ int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state); * @remarks The camera privilege(%http://tizen.org/privilege/camera) should be added if @a type is #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA.\n * The recorder privilege(%http://tizen.org/privilege/recorder) should be added if @a type is #WEBRTC_MEDIA_SOURCE_TYPE_MIC.\n * With @a type of #WEBRTC_MEDIA_SOURCE_TYPE_NULL, you can configure a transceiver only for receiving audio or video stream. (Since 7.0)\n - * @a type of #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN is not allowed to be used by third-party applications due to the security reasons. (Since 7.0) + * @a type of #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN is not allowed to be used by third-party applications due to the security reasons. (Since 7.0)\n + * The display feature(%http://tizen.org/feature/display) is required if @a type is #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] type The media source type to be added * @param[out] source_id The media source id @@ -1730,7 +1731,8 @@ int webrtc_get_audio_mute(webrtc_h webrtc, unsigned int track_id, bool *muted); * @brief Sets a display to the video track to be rendered. * @since_tizen 6.5 * @remarks Call this function within webrtc_track_added_cb(), otherwise #WEBRTC_ERROR_INVALID_OPERATION will be returned.\n - * If webrtc_set_encoded_video_frame_cb() has been called, it will return #WEBRTC_ERROR_INVALID_OPERATION. + * If webrtc_set_encoded_video_frame_cb() has been called, it will return #WEBRTC_ERROR_INVALID_OPERATION.\n + * The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] track_id The track id * @param[in] type The display type @@ -1738,6 +1740,7 @@ int webrtc_get_audio_mute(webrtc_h webrtc, unsigned int track_id, bool *muted); * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre webrtc_track_added_cb() must be set by calling webrtc_set_track_added_cb(). @@ -1753,12 +1756,14 @@ int webrtc_set_display(webrtc_h webrtc, unsigned int track_id, webrtc_display_ty /** * @brief Sets the display mode of the video track. * @since_tizen 6.5 + * @remarks The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] track_id The track id * @param[in] mode The display mode * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre For remote video track, webrtc_set_display() must be called with @a track_id from webrtc_track_added_cb().\n @@ -1770,13 +1775,15 @@ int webrtc_set_display_mode(webrtc_h webrtc, unsigned int track_id, webrtc_displ /** * @brief Gets the display mode of the video track. * @since_tizen 6.5 - * @remarks The default value is #WEBRTC_DISPLAY_MODE_LETTER_BOX. + * @remarks The default value is #WEBRTC_DISPLAY_MODE_LETTER_BOX.\n + * The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] track_id The track id * @param[out] mode The display mode * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre For remote video track, webrtc_set_display() must be called with @a track_id from webrtc_track_added_cb().\n @@ -1788,12 +1795,14 @@ int webrtc_get_display_mode(webrtc_h webrtc, unsigned int track_id, webrtc_displ /** * @brief Sets the display visibleness of the video track. * @since_tizen 6.5 + * @remarks The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] track_id The track id * @param[in] visible The display visibleness * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre For remote video track, webrtc_set_display() must be called with @a track_id from webrtc_track_added_cb().\n @@ -1805,13 +1814,15 @@ int webrtc_set_display_visible(webrtc_h webrtc, unsigned int track_id, bool visi /** * @brief Gets the display visibleness of the video track. * @since_tizen 6.5 - * @remarks The default value is @c true. + * @remarks The default value is @c true.\n + * The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] track_id The track id * @param[out] visible The display visibleness * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre For remote video track, webrtc_set_display() must be called with @a track_id from webrtc_track_added_cb().\n @@ -1939,6 +1950,7 @@ int webrtc_media_source_unset_audio_loopback(webrtc_h webrtc, unsigned int sourc * #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN\n * #WEBRTC_MEDIA_SOURCE_TYPE_FILE * @since_tizen 6.5 + * @remarks The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] source_id The video source id * @param[in] type The display type @@ -1947,6 +1959,7 @@ int webrtc_media_source_unset_audio_loopback(webrtc_h webrtc, unsigned int sourc * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source(). @@ -1961,11 +1974,13 @@ int webrtc_media_source_set_video_loopback(webrtc_h webrtc, unsigned int source_ /** * @brief Unsets the video loopback. * @since_tizen 7.0 + * @remarks The display feature(%http://tizen.org/feature/display) is required. (Since 8.0) * @param[in] webrtc WebRTC handle * @param[in] source_id The video source id * @return @c 0 on success, * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful + * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source(). diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 48db3556..8298e48f 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.4.14 +Version: 0.4.15 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index 2e71e519..f5927e5d 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -23,6 +23,7 @@ #define _WEBRTC_FEATURE_CAMERA "http://tizen.org/feature/camera" #define _WEBRTC_FEATURE_MICROPHONE "http://tizen.org/feature/microphone" +#define _WEBRTC_FEATURE_DISPLAY "http://tizen.org/feature/display" #define _WEBRTC_PRIVILEGE_INTERNET "http://tizen.org/privilege/internet" #define _WEBRTC_PRIVILEGE_CAMERA "http://tizen.org/privilege/camera" #define _WEBRTC_PRIVILEGE_RECORDER "http://tizen.org/privilege/recorder" @@ -327,6 +328,7 @@ int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, un RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_MICROPHONE); RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_RECORDER); } else if (type == WEBRTC_MEDIA_SOURCE_TYPE_SCREEN) { + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_PLATFORM); } @@ -833,6 +835,8 @@ int webrtc_set_display(webrtc_h webrtc, unsigned int track_id, webrtc_display_ty g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(track_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "track id is 0"); RET_VAL_IF(type > WEBRTC_DISPLAY_TYPE_EVAS, WEBRTC_ERROR_INVALID_PARAMETER, "invalid display type(%d)", type); @@ -853,6 +857,8 @@ int webrtc_set_display_mode(webrtc_h webrtc, unsigned int track_id, webrtc_displ g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(track_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "track id is 0"); RET_VAL_IF(mode > WEBRTC_DISPLAY_MODE_FULL, WEBRTC_ERROR_INVALID_PARAMETER, "invalid display mode(%d)", mode); @@ -869,6 +875,8 @@ int webrtc_get_display_mode(webrtc_h webrtc, unsigned int track_id, webrtc_displ g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(track_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "track id is 0"); RET_VAL_IF(mode == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "mode is NULL"); @@ -885,6 +893,8 @@ int webrtc_set_display_visible(webrtc_h webrtc, unsigned int track_id, bool visi g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(track_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "track id is 0"); @@ -900,6 +910,8 @@ int webrtc_get_display_visible(webrtc_h webrtc, unsigned int track_id, bool *vis g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(track_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "track id is 0"); RET_VAL_IF(visible == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "visible is NULL"); @@ -1033,6 +1045,8 @@ int webrtc_media_source_set_video_loopback(webrtc_h webrtc, unsigned int source_ g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); RET_VAL_IF(type > WEBRTC_DISPLAY_TYPE_EVAS, WEBRTC_ERROR_INVALID_PARAMETER, "invalid display type(%d)", type); @@ -1048,6 +1062,8 @@ int webrtc_media_source_unset_video_loopback(webrtc_h webrtc, unsigned int sourc g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_DISPLAY); + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0");