Export webrtc_set[get]_audio_mute() API to public header 31/295331/1
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 5 Jul 2023 09:16:13 +0000 (18:16 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 5 Jul 2023 09:16:36 +0000 (18:16 +0900)
[Issue Type] API

Change-Id: I64ac88a28c153ddc15661ca4f71ea596a3b48f0c
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc.h
include/webrtc_internal.h
src/webrtc.c
src/webrtc_internal.c
test/webrtc_test_menu.c

index 89c53e1c4c720e59d463154f70536e6276d6bcf9..7aec2e4436269d503a8af9a378c5cdd90b750a44 100644 (file)
@@ -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
index ff3ab1161021180a38c3406a76437b4dda4a51cd..093617875c6f8a2f844dbc76585a8e35830cdeb5 100644 (file)
@@ -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.
index be3868b0ee248a8e80f45799522fb1a8b5da3a16..2e71e519efdb489101cde483053a000ef468d282 100644 (file)
@@ -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;
index 82a77b9be1c463c03f19cdc8aa44416c76038cb0..8ee4a47da42e82bdc3d3c1c40613228d906c6c78 100644 (file)
@@ -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;
index 2585f2ce5b3c853abbdac8200422e36e82caae1d..46d20f104cb5d164b6876a80460be649cf2c97b3 100644 (file)
@@ -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
+}