g_signal_emit_by_name(source->webrtc->gst.webrtcbin, "add-transceiver",
GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY, caps, &trans, NULL);
gst_object_unref(trans);
+
+ if (source->av[av_idx].pt >= MIN_DYNAMIC_PAYLOAD_TYPE && !source->av[av_idx].pt_set_by_api)
+ _return_payload_type(source->webrtc, source->av[av_idx].pt);
+
+ if ((_set_payload_type(source->webrtc, source, av_idx, payload_info->gst_media_type)) != WEBRTC_ERROR_NONE)
+ return WEBRTC_ERROR_INVALID_OPERATION;
} else {
g_object_set(G_OBJECT(source->av[av_idx].transceiver), "codec-preferences", caps, NULL);
}
source->av[av_idx].codec = payload_info->encoding_name;
- if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL) {
- if (source->av[av_idx].pt >= MIN_DYNAMIC_PAYLOAD_TYPE)
- _return_payload_type(webrtc, source->av[av_idx].pt);
-
- if ((ret = _set_payload_type(webrtc, source, av_idx, payload_info->gst_media_type)) != WEBRTC_ERROR_NONE)
- return ret;
- }
-
/* FIXME: to utilize 'codec-preferences' of trans object, we need to re-create and re-link elements again */
LOG_INFO("webrtc[%p] source_id[%u] media_type[%d] codec[%s]", webrtc, source_id, media_type, payload_info->encoding_name);