* @param[in] webrtc WebRTC handle
* @param[in] source_id The audio source id
* @param[in] stream_info The sound stream information
+ * @param[out] track_id The track id (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #WEBRTC_ERROR_NONE Successful
* @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
* @see webrtc_media_source_set_video_loopback()
*/
-int webrtc_media_source_set_audio_loopback(webrtc_h webrtc, unsigned source_id, sound_stream_info_h stream_info);
+int webrtc_media_source_set_audio_loopback(webrtc_h webrtc, unsigned source_id, sound_stream_info_h stream_info, unsigned int *track_id);
/**
* @brief Sets a video loopback to render the video frames of the media source.
* @param[in] source_id The video source id
* @param[in] type The display type
* @param[in] display The display handle
+ * @param[out] track_id The track id (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #WEBRTC_ERROR_NONE Successful
* @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
* @see webrtc_media_source_set_audio_loopback()
*/
-int webrtc_media_source_set_video_loopback(webrtc_h webrtc, unsigned source_id, webrtc_display_type_e type, webrtc_display_h display);
+int webrtc_media_source_set_video_loopback(webrtc_h webrtc, unsigned source_id, webrtc_display_type_e type, webrtc_display_h display, unsigned int *track_id);
/**
* @}
bool pause;
unsigned int payload_id;
struct {
+ unsigned int track_id;
bool need_decoding;
GstPad *src_pad;
gulong src_pad_probe_id;
int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_video);
int _set_stream_info_to_sink(webrtc_s *webrtc, unsigned int track_id, sound_stream_info_h stream_info);
int _set_display_to_sink(webrtc_s *webrtc, unsigned int track_id, unsigned int type, void *display);
-int _set_audio_loopback(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info);
-int _set_video_loopback(webrtc_s *webrtc, unsigned int source_id, unsigned int type, void *display);
+int _set_audio_loopback(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info, unsigned int *track_id);
+int _set_video_loopback(webrtc_s *webrtc, unsigned int source_id, unsigned int type, void *display, unsigned int *track_id);
int _decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, GstCaps *caps, GstElementFactory *factory, gpointer user_data);
bool _is_owner_of_track_build_context(webrtc_s *webrtc, unsigned int track_id);
void _track_build_context_destroy_cb(gpointer data);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.2.53
+Version: 0.2.54
Release: 0
Group: Multimedia/API
License: Apache-2.0
return WEBRTC_ERROR_NONE;
}
-int webrtc_media_source_set_audio_loopback(webrtc_h webrtc, unsigned source_id, sound_stream_info_h stream_info)
+int webrtc_media_source_set_audio_loopback(webrtc_h webrtc, unsigned source_id, sound_stream_info_h stream_info, unsigned int *track_id)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
g_mutex_lock(&_webrtc->mutex);
- ret = _set_audio_loopback(webrtc, source_id, stream_info);
+ ret = _set_audio_loopback(webrtc, source_id, stream_info, track_id);
g_mutex_unlock(&_webrtc->mutex);
return ret;
}
-int webrtc_media_source_set_video_loopback(webrtc_h webrtc, unsigned source_id, webrtc_display_type_e type, webrtc_display_h display)
+int webrtc_media_source_set_video_loopback(webrtc_h webrtc, unsigned source_id, webrtc_display_type_e type, webrtc_display_h display, unsigned int *track_id)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
g_mutex_lock(&_webrtc->mutex);
- ret = _set_video_loopback(webrtc, source_id, (unsigned int)type, (void *)display);
+ ret = _set_video_loopback(webrtc, source_id, (unsigned int)type, (void *)display, track_id);
g_mutex_unlock(&_webrtc->mutex);
}
}
-static int __build_loopback_render_pipeline(webrtc_s *webrtc, webrtc_gst_slot_s *source, media_type_e type)
+static int __build_loopback_render_pipeline(webrtc_s *webrtc, webrtc_gst_slot_s *source, media_type_e type, unsigned int *track_id)
{
int idx = (type == MEDIA_TYPE_AUDIO) ? AV_IDX_AUDIO : AV_IDX_VIDEO;
GstElement *appsrc;
source->av[idx].render.appsrc = appsrc;
- LOG_INFO("source_id[%u] pipeline[%p, %s] appsrc[%p]", source->id, source->av[idx].render.pipeline,
+ /* NOTE : The track id has already been used for a remote stream. Here we newly add the track id
+ * for loopback rendering pipeline, we also need to distinguish which value belongs to remote's
+ * or loopback's. Hence a simple operation is added to make the track id of loopback's. */
+ source->av[idx].render.track_id = source->id * 100 + idx;
+
+ LOG_INFO("source_id[%u] track_id[%u] pipeline[%p, %s] appsrc[%p]",
+ source->id, source->av[idx].render.track_id, source->av[idx].render.pipeline,
GST_ELEMENT_NAME(source->av[idx].render.pipeline), source->av[idx].render.appsrc);
gst_element_set_state(source->av[idx].render.pipeline, GST_STATE_PLAYING);
+ if (track_id)
+ *track_id = source->av[idx].render.track_id;
+
return WEBRTC_ERROR_NONE;
error:
return WEBRTC_ERROR_INVALID_OPERATION;
}
-int _set_audio_loopback(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info)
+int _set_audio_loopback(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info, unsigned int *track_id)
{
webrtc_gst_slot_s *source;
char *stream_type;
LOG_INFO("source_id[%u] stream_info[%p, type:%s, index:%d]", source_id, stream_info, stream_type, stream_index);
- return __build_loopback_render_pipeline(webrtc, source, MEDIA_TYPE_AUDIO);
+ return __build_loopback_render_pipeline(webrtc, source, MEDIA_TYPE_AUDIO, track_id);
}
-int _set_video_loopback(webrtc_s *webrtc, unsigned int source_id, unsigned int type, void *display)
+int _set_video_loopback(webrtc_s *webrtc, unsigned int source_id, unsigned int type, void *display, unsigned int *track_id)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_gst_slot_s *source;
if (ret != WEBRTC_ERROR_NONE)
goto error;
- ret = __build_loopback_render_pipeline(webrtc, source, MEDIA_TYPE_VIDEO);
+ ret = __build_loopback_render_pipeline(webrtc, source, MEDIA_TYPE_VIDEO, track_id);
if (ret != WEBRTC_ERROR_NONE)
goto error;
RET_IF(ret != SOUND_MANAGER_ERROR_NONE, "failed to sound_manager_create_stream_information(), ret[0x%x]", ret);
}
- ret = webrtc_media_source_set_audio_loopback(g_conns[index].webrtc, source_id, g_conns[index].render.stream_info);
+ ret = webrtc_media_source_set_audio_loopback(g_conns[index].webrtc, source_id, g_conns[index].render.stream_info, NULL);
RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
g_print("webrtc_media_source_set_audio_loopback() success, source_id[%u]\n", source_id);
{
int ret = WEBRTC_ERROR_NONE;
- ret = webrtc_media_source_set_video_loopback(g_conns[index].webrtc, source_id, WEBRTC_DISPLAY_TYPE_EVAS, g_eo_mine);
+ ret = webrtc_media_source_set_video_loopback(g_conns[index].webrtc, source_id, WEBRTC_DISPLAY_TYPE_EVAS, g_eo_mine, NULL);
RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
g_print("webrtc_media_source_set_video_loopback() success, source_id[%u]\n", source_id);