Transceiver's direction can be changed for each media types before webrtc_start().
However, file source's media types were determined after webrtc_start().
So, set media types when set media path(before webrtc_start()), and allow transceiver direction change.
[Version] 0.3.163
[Issue Type] Improvement
Change-Id: I181ba95e5877fad103e50d8253cda8eeeba0d66f
SET(dependents "dlog glib-2.0 gstreamer-1.0 gstreamer-webrtc-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 \
gstreamer-allocators-1.0 libpulse json-glib-1.0 iniparser mm-common mm-display-interface capi-media-tool \
- libtbm libwebsockets cynara-client libsmack capi-system-info libsoup-2.4 bundle capi-media-sound-manager")
+ libtbm libwebsockets cynara-client libsmack capi-system-info libsoup-2.4 bundle capi-media-sound-manager mm-fileinfo")
IF(NOT TIZEN_PROFILE_TV)
SET(dependents "${dependents} mm-resource-manager")
ELSE()
int _set_filesrc_looping(webrtc_s *webrtc, unsigned int source_id, bool looping);
int _get_filesrc_looping(webrtc_s *webrtc, unsigned int source_id, bool *looping);
int _remove_filesrc_pad_block_probe(webrtc_s *webrtc);
+void _set_filesrc_media_types(webrtc_gst_slot_s *source, const char *path);
int _build_mediapacketsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source);
int _complete_rest_of_mediapacketsrc(webrtc_gst_slot_s *source, GstPad **src_pad, GstElement *appsrc, GList *element_list);
int _complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrtc_gst_slot_s *source);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.3.162
+Version: 0.3.163
Release: 0
Group: Multimedia/API
License: Apache-2.0
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-media-sound-manager)
BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(mm-fileinfo)
%if "%{tizen_profile_name}" != "tv"
BuildRequires: pkgconfig(mm-resource-manager)
BuildRequires: pkgconfig(esplusplayer)
LOG_INFO("setting caps for [%s appsrc] successfully", (av_idx == AV_IDX_AUDIO) ? "audio" : "video");
PRINT_CAPS(caps, "appsrc");
- source->av[av_idx].codec = gst_structure_get_string(gst_caps_get_structure(caps, 0), "encoding-name");
- gst_caps_unref(caps);
-
source->filesrc_av[av_idx].sink_pad = pad;
source->filesrc_av[av_idx].sink_pad_probe_id = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BLOCK,
__fakesink_block_probe_cb, source, NULL);
+ source->av[av_idx].codec = gst_structure_get_string(gst_caps_get_structure(caps, 0), "encoding-name");
+
+ if (source->av[av_idx].direction == WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY) {
+ rtp_payload_info_s payload_info = {
+ .media_type = _get_media_type_from_pad(pad),
+ .encoding_name = source->av[av_idx].codec,
+ };
+ gst_structure_get_int(gst_caps_get_structure(caps, 0), "clock-rate", &payload_info.clock_rate);
+ __add_transceiver(source, (av_idx == AV_IDX_AUDIO) ? WEBRTC_MEDIA_TYPE_AUDIO : WEBRTC_MEDIA_TYPE_VIDEO, &payload_info);
+ g_free((gchar *)payload_info.media_type);
+ }
+ gst_caps_unref(caps);
return GST_PAD_PROBE_REMOVE;
}
if (location) {
__release_filesrc_resources(source);
g_free(location);
+ source->media_types = 0;
}
g_object_set(G_OBJECT(filesrc), "location", path, NULL);
+ _set_filesrc_media_types(source, path);
+
LOG_DEBUG("source_id[%u] path[%s]", source_id, path);
return WEBRTC_ERROR_NONE;
* limitations under the License.
*/
+#include <mm_file.h>
+
#include "webrtc_private.h"
#include "webrtc_source_private.h"
return WEBRTC_ERROR_NONE;
}
+
+void _set_filesrc_media_types(webrtc_gst_slot_s *source, const char *path)
+{
+ int ret = FILEINFO_ERROR_NONE;
+ int audio_tracks_num = 0;
+ int video_tracks_num = 0;
+
+ RET_IF(source == NULL, "source is NULL");
+ RET_IF(path == NULL, "path is NULL");
+
+ ret = mm_file_get_stream_info(path, &audio_tracks_num, &video_tracks_num);
+ RET_IF(ret != FILEINFO_ERROR_NONE, "fail to mm_file_get_stream_info [%d]", ret);
+
+ LOG_DEBUG("audio_tracks_num[%d] video_tracks_num[%d]", audio_tracks_num, video_tracks_num);
+
+ if (audio_tracks_num)
+ source->media_types |= MEDIA_TYPE_AUDIO;
+
+ if (video_tracks_num)
+ source->media_types |= MEDIA_TYPE_VIDEO;
+}