*/
int webrtc_add_media_source_internal(webrtc_h webrtc, webrtc_media_source_type_internal_e type, unsigned int *source_id);
+/**
+ * @internal
+ * @brief Sets the payload type to the media source.
+ * @since_tizen 7.0
+ * @remarks This function would be useful when @a webrtc is operated as an answerer and a remote peer is using another implementation, not this API.
+ * @param[in] webrtc WebRTC handle
+ * @param[in] source_id The media source id
+ * @param[in] media_type The media type
+ * @param[in] pt The payload type
+ * @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_STATE Invalid state
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
+ * @see webrtc_media_source_get_payload_type()
+ */
+int webrtc_media_source_set_payload_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, unsigned int pt);
+
+/**
+ * @internal
+ * @brief Gets the payload type of the media source.
+ * @since_tizen 7.0
+ * @param[in] webrtc WebRTC handle
+ * @param[in] source_id The media source id
+ * @param[in] media_type The media type
+ * @param[out] pt The payload type
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @see webrtc_media_source_set_payload_type()
+ */
+int webrtc_media_source_get_payload_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, unsigned int *pt);
+
/**
* @internal
* @brief Sets the crop coordinates of screen source.
return ret;
}
+int webrtc_media_source_set_payload_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, unsigned int pt)
+{
+ webrtc_s *_webrtc = (webrtc_s *)webrtc;
+ webrtc_gst_slot_s *source;
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ 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((source = _get_slot_by_id(_webrtc->gst.source_slots, source_id)) == NULL,
+ WEBRTC_ERROR_INVALID_PARAMETER, "could not find source");
+
+ locker = g_mutex_locker_new(&_webrtc->mutex);
+
+ RET_VAL_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should be IDLE");
+
+ source->av[GET_AV_IDX(media_type == WEBRTC_MEDIA_TYPE_AUDIO)].pt = pt;
+ source->av[GET_AV_IDX(media_type == WEBRTC_MEDIA_TYPE_AUDIO)].pt_set_by_api = true;
+
+ LOG_INFO("webrtc[%p] source_id[%u] media_type[%u] payload type[%u]", _webrtc, source_id, media_type, pt);
+
+ return WEBRTC_ERROR_NONE;
+}
+
+int webrtc_media_source_get_payload_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, unsigned int *pt)
+{
+ webrtc_s *_webrtc = (webrtc_s *)webrtc;
+ webrtc_gst_slot_s *source;
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ 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(pt == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "pt is NULL");
+ RET_VAL_IF((source = _get_slot_by_id(_webrtc->gst.source_slots, source_id)) == NULL,
+ WEBRTC_ERROR_INVALID_PARAMETER, "could not find source");
+
+ locker = g_mutex_locker_new(&_webrtc->mutex);
+
+ *pt = source->av[GET_AV_IDX(media_type == WEBRTC_MEDIA_TYPE_AUDIO)].pt;
+
+ LOG_INFO("webrtc[%p] source_id[%u] media_type[%u] payload type[%u]", _webrtc, source_id, media_type, *pt);
+
+ return WEBRTC_ERROR_NONE;
+}
+
int webrtc_screen_source_set_crop(webrtc_h webrtc, unsigned int source_id, int x, int y, int w, int h, bool portrait_mode, int *width, int *height)
{
g_autoptr(GMutexLocker) locker = NULL;