if (!(volume = _create_element(DEFAULT_ELEMENT_VOLUME, ELEMENT_NAME_VOLUME)))
goto exit;
+ if (!g_object_class_find_property(G_OBJECT_GET_CLASS(volume), "mute")) {
+ LOG_ERROR("there is no mute property");
+ goto exit;
+ }
APPEND_ELEMENT(element_list, volume);
+ g_object_set(volume, "mute", (gboolean)source->av[AV_IDX_AUDIO].mute, NULL);
+
source->av[AV_IDX_AUDIO].inbandfec = ini_source->use_inbandfec;
source->av[AV_IDX_AUDIO].packet_loss_percentage = ini_source->packet_loss_percentage;
static int __validate_audio_source_for_mute(webrtc_s *webrtc, unsigned int source_id, webrtc_gst_slot_s **source)
{
webrtc_gst_slot_s *_source;
- GstElement *volume;
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");
return WEBRTC_ERROR_INVALID_PARAMETER;
}
- volume = gst_bin_get_by_name(_source->bin, ELEMENT_NAME_VOLUME);
- RET_VAL_IF(volume == NULL, WEBRTC_ERROR_INVALID_OPERATION, "volume is NULL");
-
- if (!g_object_class_find_property(G_OBJECT_GET_CLASS(volume), "mute")) {
- LOG_ERROR("there is no mute property");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
-
if (source)
*source = _source;
{
int ret;
webrtc_gst_slot_s *source;
+ GstElement *volume;
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");
if ((ret = __validate_audio_source_for_mute(webrtc, source_id, &source)) != WEBRTC_ERROR_NONE)
return ret;
- g_object_set(gst_bin_get_by_name(source->bin, ELEMENT_NAME_VOLUME), "mute", mute, NULL);
+ if ((volume = gst_bin_get_by_name(source->bin, ELEMENT_NAME_VOLUME))) {
+ if (!g_object_class_find_property(G_OBJECT_GET_CLASS(volume), "mute")) {
+ LOG_ERROR("there is no mute property");
+ return WEBRTC_ERROR_INVALID_OPERATION;
+ }
+ g_object_set(volume, "mute", mute, NULL);
+ }
+
+ source->av[AV_IDX_AUDIO].mute = mute;
LOG_INFO("webrtc[%p] source_id[%u] mute[%d]", webrtc, source_id, mute);
{
int ret;
webrtc_gst_slot_s *source;
- gboolean _muted;
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");
if ((ret = __validate_audio_source_for_mute(webrtc, source_id, &source)) != WEBRTC_ERROR_NONE)
return ret;
- g_object_get(gst_bin_get_by_name(source->bin, ELEMENT_NAME_VOLUME), "mute", &_muted, NULL);
-
- *muted = (bool)_muted;
+ *muted = source->av[AV_IDX_AUDIO].mute;
LOG_INFO("webrtc[%p] source_id[%u] muted[%d]", webrtc, source_id, *muted);