webrtc, transceiver, mlineindex, mid, direction, kind, user_data);
PRINT_CAPS(caps, "codec preferences");
+ /* Code below is for the scenario of an answerer without any added media sources. */
if (g_hash_table_size(webrtc->gst.source_slots) == 0) {
if (mlineindex >= MAX_MLINE_NUM) {
LOG_ERROR("mlineindex[%u] exceeds the max value", mlineindex);
return;
}
- /* In this case, it might be an answerer without setting any media source. */
if (webrtc->data_recovery_types[mlineindex].red &&
webrtc->data_recovery_types[mlineindex].ulpfec)
__webrtcbin_transceiver_set_ulpfec_red(webrtc, transceiver);
{
const ini_item_media_source_s *ini_source;
GstWebRTCRTPTransceiver *transceiver;
- GHashTableIter iter;
- gpointer key, value;
webrtc_gst_slot_s *source;
- int i;
- guint mlineindex;
+ int i, j;
GstWebRTCRTPTransceiverDirection direction;
RET_IF(webrtc == NULL, "webrtc is NULL");
- g_hash_table_iter_init(&iter, webrtc->gst.source_slots);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- source = (webrtc_gst_slot_s *)value;
- for (i = AV_IDX_AUDIO; i < AV_IDX_MAX; i++) {
- if (!(source->media_types & (i == AV_IDX_AUDIO ? MEDIA_TYPE_AUDIO : MEDIA_TYPE_VIDEO)))
+ for (i = 0; i < MAX_SOURCE_NUM; i++) {
+ if (!(source = webrtc->gst.sources[i]))
+ continue;
+ for (j = AV_IDX_AUDIO; j < AV_IDX_MAX; j++) {
+ if (!(source->media_types & (j == AV_IDX_AUDIO ? MEDIA_TYPE_AUDIO : MEDIA_TYPE_VIDEO)))
continue;
- if (!(transceiver = source->av[i].transceiver))
+ if (!(transceiver = source->av[j].transceiver))
continue;
- g_object_get(G_OBJECT(transceiver),
- "mlineindex", &mlineindex,
- "direction", &direction,
- NULL);
+ g_object_get(G_OBJECT(transceiver), "direction", &direction, NULL);
ini_source = _ini_get_source_by_type(&webrtc->ini, source->type);
if (ini_source == NULL)
continue;
__webrtcbin_transceiver_set_ulpfec_red(webrtc, transceiver);
} else {
- /* NOTE that this maximum value exists only for data_recovery_types due to the scenario an answerer
- * without any added media sources. It would be moved to the source slot without this scenario. */
- if (mlineindex >= MAX_MLINE_NUM) {
- LOG_ERROR("mline[%u] exceeds the max value", mlineindex);
- continue;
- }
- if (!webrtc->data_recovery_types[mlineindex].red ||
- !webrtc->data_recovery_types[mlineindex].ulpfec)
+ if (!webrtc->data_recovery_types[i].red ||
+ !webrtc->data_recovery_types[i].ulpfec)
continue;
__webrtcbin_transceiver_set_ulpfec_red(webrtc, transceiver);
}