If this function is used to set a payload type value, the value of
the parameter can be used even if it is already assigned by other one.
It is cherry-picked from
6c85f708f6c112dd80ecbb3cffc90b246b0b7b32
commit of tizen 9.0.
[Version] 0.3.308
[Issue Type] Improvement
Change-Id: I143beac2ef5737bec77c68c9d789f3ee905ca5a7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
int _set_payload_type(webrtc_s *webrtc, webrtc_gst_slot_s *source, int av_idx, const gchar *media_type);
int _get_fixed_payload_type(const gchar *media_type);
void _return_payload_type(webrtc_s *webrtc, unsigned int payload_type);
-int _set_manual_payload_type(webrtc_s *webrtc, unsigned int payload_type);
void _check_and_add_recvonly_transceiver(webrtc_gst_slot_s *source);
int _add_transceiver(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info);
int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.3.307
+Version: 0.3.308
Release: 0
Group: Multimedia/API
License: Apache-2.0
return WEBRTC_ERROR_INVALID_PARAMETER;
} else if (pt == source->av[av_idx].pt) {
+ if (!source->av[av_idx].pt_set_by_api)
+ _return_payload_type(_webrtc, source->av[av_idx].pt);
source->av[av_idx].pt_set_by_api = true;
LOG_INFO("already payload type[%u] was set", pt == source->av[av_idx].pt);
return WEBRTC_ERROR_NONE;
return WEBRTC_ERROR_INVALID_PARAMETER;
}
- /* occupy the pt if it is not used */
- if (_set_manual_payload_type(_webrtc, pt) != 0)
- return WEBRTC_ERROR_INVALID_PARAMETER;
-
/* release the previous pt */
- if (source->av[av_idx].pt > 0)
+ if (!source->av[av_idx].pt_set_by_api && source->av[av_idx].pt > 0)
_return_payload_type(_webrtc, source->av[av_idx].pt);
source->av[av_idx].pt = pt;
webrtc->payload_types ^= bitmask;
}
-int _set_manual_payload_type(webrtc_s *webrtc, unsigned int payload_type)
-{
- int bitmask = 0x1;
- int count = 0;
-
- RET_VAL_IF(webrtc == NULL, -1, "webrtc is NULL");
- RET_VAL_IF(payload_type < MIN_DYNAMIC_PAYLOAD_TYPE || payload_type > MAX_DYNAMIC_PAYLOAD_TYPE, -1, "invalid payload_type(%u)", payload_type);
-
- while (++count != (int)(payload_type - MIN_DYNAMIC_PAYLOAD_TYPE + 1))
- bitmask <<= 1;
-
- if ((webrtc->payload_types & bitmask)) {
- LOG_ERROR("already occupied pt[%u]", payload_type);
- return -1;
- }
-
- webrtc->payload_types |= bitmask;
- return 0;
-}
-
void _check_and_add_recvonly_transceiver(webrtc_gst_slot_s *source)
{
rtp_payload_info_s *payload_info = NULL;