From: Sangchul Lee Date: Wed, 5 Jul 2023 09:16:13 +0000 (+0900) Subject: Export webrtc_set[get]_audio_mute() API to public header X-Git-Tag: accepted/tizen/unified/20230718.162206~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b5e37217c5f98eb7e5741e573e6f97e12e952d8;p=platform%2Fcore%2Fapi%2Fwebrtc.git Export webrtc_set[get]_audio_mute() API to public header [Issue Type] API Change-Id: I64ac88a28c153ddc15661ca4f71ea596a3b48f0c Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc.h b/include/webrtc.h index 89c53e1c..7aec2e44 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -1690,6 +1690,42 @@ int webrtc_screen_source_unset_crop(webrtc_h webrtc, unsigned int source_id); */ int webrtc_set_sound_stream_info(webrtc_h webrtc, unsigned int track_id, sound_stream_info_h stream_info); +/** + * @brief Sets mute to the audio track. + * @since_tizen 8.0 + * @remarks If @a mute is set to @c true, playback of audio track received from a remote peer will be muted. + * @param[in] webrtc WebRTC handle + * @param[in] track_id The track id + * @param[in] mute Mute or not (@c true = mute, @c false = not mute) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #WEBRTC_ERROR_NONE Successful + * @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(). + * @pre Call webrtc_set_sound_stream_info() before calling this function. + * @see webrtc_get_audio_mute() + */ +int webrtc_set_audio_mute(webrtc_h webrtc, unsigned int track_id, bool mute); + +/** + * @brief Gets the mute state of the audio track. + * @since_tizen 8.0 + * @remarks The default value is @c false. + * @param[in] webrtc WebRTC handle + * @param[in] track_id The track id + * @param[out] muted Muted or not (@c true = muted, @c false = not muted) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #WEBRTC_ERROR_NONE Successful + * @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(). + * @pre Call webrtc_set_sound_stream_info() before calling this function. + * @see webrtc_set_audio_mute() + */ +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 diff --git a/include/webrtc_internal.h b/include/webrtc_internal.h index ff3ab116..09361787 100644 --- a/include/webrtc_internal.h +++ b/include/webrtc_internal.h @@ -169,44 +169,6 @@ int webrtc_set_ecore_wl_display(webrtc_h webrtc, unsigned int track_id, void *ec */ int webrtc_set_display_surface_id(webrtc_h webrtc, unsigned int track_id, int surface_id, int x, int y, int width, int height); -/** - * @internal - * @brief Sets mute to the audio track. - * @since_tizen 6.5 - * @remarks If @a mute is set to @c true, playback of audio track received from a remote peer will be muted. - * @param[in] webrtc WebRTC handle - * @param[in] track_id The track id - * @param[in] mute Mute or not (@c true = mute, @c false = not mute) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #WEBRTC_ERROR_NONE Successful - * @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(). - * @pre Call webrtc_set_sound_stream_info() before calling this function. - * @see webrtc_get_audio_mute() - */ -int webrtc_set_audio_mute(webrtc_h webrtc, unsigned int track_id, bool mute); - -/** - * @internal - * @brief Gets the mute state of the audio track. - * @since_tizen 6.5 - * @remarks The default value is @c false. - * @param[in] webrtc WebRTC handle - * @param[in] track_id The track id - * @param[out] muted Muted or not (@c true = muted, @c false = not muted) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #WEBRTC_ERROR_NONE Successful - * @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(). - * @pre Call webrtc_set_sound_stream_info() before calling this function. - * @see webrtc_set_audio_mute() - */ -int webrtc_get_audio_mute(webrtc_h webrtc, unsigned int track_id, bool *muted); - /** * @internal * @brief Gets the video resolution of the video track. diff --git a/src/webrtc.c b/src/webrtc.c index be3868b0..2e71e519 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -799,6 +799,35 @@ int webrtc_set_sound_stream_info(webrtc_h webrtc, unsigned int track_id, sound_s return _set_stream_info_to_sink(webrtc, track_id, stream_info); } +int webrtc_set_audio_mute(webrtc_h webrtc, unsigned int track_id, bool mute) +{ + g_autoptr(GMutexLocker) locker = NULL; + webrtc_s *_webrtc = (webrtc_s *)webrtc; + + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); + + locker = g_mutex_locker_new(&_webrtc->mutex); + + RET_VAL_IF(_webrtc->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, "track added callback was not set"); + + return _set_audio_mute_to_sink(_webrtc, track_id, mute); +} + +int webrtc_get_audio_mute(webrtc_h webrtc, unsigned int track_id, bool *muted) +{ + g_autoptr(GMutexLocker) locker = NULL; + webrtc_s *_webrtc = (webrtc_s *)webrtc; + + RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); + RET_VAL_IF(muted == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "muted is NULL"); + + locker = g_mutex_locker_new(&_webrtc->mutex); + + RET_VAL_IF(_webrtc->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, "track added callback was not set"); + + return _get_audio_mute_from_sink(_webrtc, track_id, muted); +} + int webrtc_set_display(webrtc_h webrtc, unsigned int track_id, webrtc_display_type_e type, webrtc_display_h display) { g_autoptr(GMutexLocker) locker = NULL; diff --git a/src/webrtc_internal.c b/src/webrtc_internal.c index 82a77b9b..8ee4a47d 100644 --- a/src/webrtc_internal.c +++ b/src/webrtc_internal.c @@ -59,35 +59,6 @@ int webrtc_set_display_surface_id(webrtc_h webrtc, unsigned int track_id, int su return _set_display_surface_id_to_sink(webrtc, track_id, surface_id, x, y, width, height); } -int webrtc_set_audio_mute(webrtc_h webrtc, unsigned int track_id, bool mute) -{ - g_autoptr(GMutexLocker) locker = NULL; - webrtc_s *_webrtc = (webrtc_s *)webrtc; - - RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - - locker = g_mutex_locker_new(&_webrtc->mutex); - - RET_VAL_IF(_webrtc->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, "track added callback was not set"); - - return _set_audio_mute_to_sink(_webrtc, track_id, mute); -} - -int webrtc_get_audio_mute(webrtc_h webrtc, unsigned int track_id, bool *muted) -{ - g_autoptr(GMutexLocker) locker = NULL; - webrtc_s *_webrtc = (webrtc_s *)webrtc; - - RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(muted == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "muted is NULL"); - - locker = g_mutex_locker_new(&_webrtc->mutex); - - RET_VAL_IF(_webrtc->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, "track added callback was not set"); - - return _get_audio_mute_from_sink(_webrtc, track_id, muted); -} - int webrtc_get_video_resolution(webrtc_h webrtc, unsigned int track_id, int *width, int *height) { g_autoptr(GMutexLocker) locker = NULL; diff --git a/test/webrtc_test_menu.c b/test/webrtc_test_menu.c index 2585f2ce..46d20f10 100644 --- a/test/webrtc_test_menu.c +++ b/test/webrtc_test_menu.c @@ -254,8 +254,8 @@ void display_menu_main(void) g_print("gm. Get display mode\n"); g_print("dv. Set display visible\t"); g_print("gv. Get display visible\n"); - g_print("*sam. Set audio mute\t"); - g_print("*gam. Get audio mute\n"); + g_print("sam. Set audio mute\t"); + g_print("gam. Get audio mute\n"); g_print("*gvr. Get video resolution\n"); g_print("*tsn. Take snapshot\n"); g_print("al. Set audio loopback\t"); @@ -669,4 +669,4 @@ void displaymenu(void) void reset_menu_state(void) { get_appdata()->menu_status = CURRENT_STATUS_MAINMENU; -} \ No newline at end of file +}