This patch is only for WEBRTC_MEDIA_SOURCE_TYPE_NULL.
This fixes a compatibility issue in case of
chrome(offerer) - tizen native API(answerer)
[Version] 0.3.208
[Issue Type] Compatibility
Change-Id: Ib367e5142b4082bac02acf95329c9f3fb3eafa55
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
/* source */
int _complete_sources(webrtc_s *webrtc);
+void _update_transceivers_for_offer(webrtc_s *webrtc);
void _source_slot_destroy_cb(gpointer data);
int _add_media_source(webrtc_s *webrtc, int type, unsigned int *source_id);
int _add_media_source_internal(webrtc_s *webrtc, int type, unsigned int *source_id);
rtp_payload_info_s * _get_payload_info(webrtc_transceiver_codec_e codec);
rtp_payload_info_s * _get_payload_info_by_encoding_name(const char *encoding_name);
int _add_transceiver(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info);
+int _update_transceiver_with_pt(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info);
int _link_source_with_webrtcbin(webrtc_gst_slot_s *source, GstElement *webrtcbin);
int _create_rest_of_elements(webrtc_s *webrtc, webrtc_gst_slot_s *source, bool need_capsfilter, GList **element_list, bool is_audio);
int _set_encoder_element_bitrate(GstElement *encoder, int target_bitrate);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.3.207
+Version: 0.3.208
Release: 0
Group: Multimedia/API
License: Apache-2.0
LOG_INFO("webrtc[%p] offer[%p]", webrtc, offer);
_update_transceivers_fec(webrtc, true);
+ _update_transceivers_for_offer(webrtc);
return _webrtcbin_create_session_description(webrtc, true, offer);
}
RET_IF(source == NULL, "source is NULL");
if (source->av[AV_IDX_AUDIO].direction == WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY && source->av[AV_IDX_AUDIO].codec) {
- payload_info = _get_payload_info_by_encoding_name(source->av[AV_IDX_AUDIO].codec);
- if (payload_info)
+ if ((payload_info = _get_payload_info_by_encoding_name(source->av[AV_IDX_AUDIO].codec)))
_add_transceiver(source, WEBRTC_MEDIA_TYPE_AUDIO, payload_info);
}
if (source->av[AV_IDX_VIDEO].direction == WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY && source->av[AV_IDX_VIDEO].codec) {
- payload_info = _get_payload_info_by_encoding_name(source->av[AV_IDX_VIDEO].codec);
- if (payload_info)
+ if ((payload_info = _get_payload_info_by_encoding_name(source->av[AV_IDX_VIDEO].codec)))
_add_transceiver(source, WEBRTC_MEDIA_TYPE_VIDEO, payload_info);
}
}
+static void __check_and_update_transceiver(webrtc_gst_slot_s *source)
+{
+ rtp_payload_info_s *payload_info = NULL;
+
+ RET_IF(source == NULL, "source is NULL");
+
+ if (source->av[AV_IDX_AUDIO].direction == WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY && source->av[AV_IDX_AUDIO].codec) {
+ if ((payload_info = _get_payload_info_by_encoding_name(source->av[AV_IDX_AUDIO].codec)))
+ _update_transceiver_with_pt(source, WEBRTC_MEDIA_TYPE_AUDIO, payload_info);
+ }
+
+ if (source->av[AV_IDX_VIDEO].direction == WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY && source->av[AV_IDX_VIDEO].codec) {
+ if ((payload_info = _get_payload_info_by_encoding_name(source->av[AV_IDX_VIDEO].codec)))
+ _update_transceiver_with_pt(source, WEBRTC_MEDIA_TYPE_VIDEO, payload_info);
+ }
+}
+
+void _update_transceivers_for_offer(webrtc_s *webrtc)
+{
+ int i;
+ webrtc_gst_slot_s *source;
+ RET_IF(webrtc == NULL, "webrtc is NULL");
+
+ for (i = 0; i < MAX_SOURCE_NUM; i++) {
+ if (!(source = webrtc->gst.sources[i]))
+ continue;
+
+ if (source->type != WEBRTC_MEDIA_SOURCE_TYPE_NULL)
+ continue;
+
+ LOG_DEBUG("source[id:%u, type:%d, media_types:0x%x]", source->id, source->type, source->media_types);
+
+ __check_and_update_transceiver(source);
+ }
+}
+
int _complete_sources(webrtc_s *webrtc)
{
int i;
return NULL;
}
-static GstCaps *__make_transceiver_caps(rtp_payload_info_s *payload_info, int payload_type)
+static GstCaps *__make_transceiver_caps(rtp_payload_info_s *payload_info)
+{
+ RET_VAL_IF(payload_info == NULL, NULL, "payload_info is NULL");
+
+ return gst_caps_new_simple("application/x-rtp",
+ "media", G_TYPE_STRING, payload_info->media_type,
+ "encoding-name", G_TYPE_STRING, payload_info->encoding_name,
+ "clock-rate", G_TYPE_INT, payload_info->clock_rate,
+ NULL);
+}
+
+static GstCaps *__make_transceiver_caps_with_pt(rtp_payload_info_s *payload_info, int payload_type)
{
RET_VAL_IF(payload_info == NULL, NULL, "payload_info is NULL");
int _add_transceiver(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info)
{
- GstWebRTCRTPTransceiver *trans = NULL;
- GstCaps *caps = NULL;
+ GstWebRTCRTPTransceiver *trans;
+ GstCaps *caps;
int av_idx = (media_type == WEBRTC_MEDIA_TYPE_AUDIO) ? AV_IDX_AUDIO : AV_IDX_VIDEO;
RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
RET_VAL_IF(payload_info == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "payload_info is NULL");
- caps = __make_transceiver_caps(payload_info, source->av[av_idx].pt);
+ caps = __make_transceiver_caps(payload_info);
PRINT_CAPS(caps, "transceiver");
if (!source->av[av_idx].transceiver) {
return WEBRTC_ERROR_NONE;
}
+int _update_transceiver_with_pt(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info)
+{
+ GstCaps *caps;
+ int av_idx = (media_type == WEBRTC_MEDIA_TYPE_AUDIO) ? AV_IDX_AUDIO : AV_IDX_VIDEO;
+
+ RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+ RET_VAL_IF(payload_info == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "payload_info is NULL");
+ RET_VAL_IF(source->av[av_idx].transceiver == NULL, WEBRTC_ERROR_INVALID_OPERATION, "transceiver is NULL");
+
+ caps = __make_transceiver_caps_with_pt(payload_info, source->av[av_idx].pt);
+ PRINT_CAPS(caps, "transceiver");
+
+ g_object_set(G_OBJECT(source->av[av_idx].transceiver), "codec-preferences", caps, NULL);
+
+ gst_caps_unref(caps);
+
+ LOG_DEBUG("webrtc[%p] source_id[%u] [%s] transceiver[%p] codec[%s]",
+ source->webrtc, source->id, payload_info->media_type, source->av[av_idx].transceiver, payload_info->encoding_name);
+
+ return WEBRTC_ERROR_NONE;
+}
+
static bool __is_linked_pad(webrtc_gst_slot_s *source, const char *pad_name)
{
GstIterator *iter = NULL;