webrtc_source: Remove restriction which only allowed H264 format for encoded media... 01/261801/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 26 Jul 2021 12:59:57 +0000 (21:59 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 27 Jul 2021 01:14:49 +0000 (10:14 +0900)
Supported formats are added to @remarks of webrtc_media_packet_source_set_format().

[Version] 0.2.58
[Issue Type] Improvement

Change-Id: Iae3f4c65c86264f579aabcf0e248de03b13a4c7d
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc_source.c

index 7d4cb755b79ec83fad53879539c2893729464399..7ffaf96d80cdce6c6797637d24b7ce296c7d2890 100644 (file)
@@ -896,7 +896,7 @@ int webrtc_media_source_get_video_resolution(webrtc_h webrtc, unsigned int sourc
  * @details If @a source_id is not a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MIC, this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
  * @since_tizen 6.5
  * @remarks You can set sound stream information including audio routing.\n
- *          The following sound stream types can be used for the @a stream_info :\n
+ *          The following sound stream types can be used to create the @a stream_info :\n
  *          #SOUND_STREAM_TYPE_MEDIA\n
  *          #SOUND_STREAM_TYPE_VOICE_RECOGNITION\n
  *          #SOUND_STREAM_TYPE_VOIP\n
@@ -954,6 +954,20 @@ int webrtc_media_packet_source_unset_buffer_state_changed_cb(webrtc_h webrtc, un
 /**
  * @brief Sets media format to the media packet source.
  * @since_tizen 6.5
+ * @remarks The following media format mimetypes can be used to create the @a format :\n
+ *          #MEDIA_FORMAT_VORBIS\n
+ *          #MEDIA_FORMAT_OPUS\n
+ *          #MEDIA_FORMAT_PCM_S16LE\n
+ *          #MEDIA_FORMAT_PCM_S24LE\n
+ *          #MEDIA_FORMAT_H264_SP\n
+ *          #MEDIA_FORMAT_H264_MP\n
+ *          #MEDIA_FORMAT_H264_HP\n
+ *          #MEDIA_FORMAT_MJPEG\n
+ *          #MEDIA_FORMAT_VP8\n
+ *          #MEDIA_FORMAT_VP9\n
+ *          #MEDIA_FORMAT_I420\n
+ *          #MEDIA_FORMAT_NV12\n
+ *          For more details, please refer to @ref CAPI_MEDIA_TOOL_MEDIA_FORMAT_MODULE.
  * @param[in] webrtc      WebRTC handle
  * @param[in] source_id   The media packet source id
  * @param[in] format      The media format
@@ -1023,10 +1037,11 @@ int webrtc_file_source_set_path(webrtc_h webrtc, unsigned int source_id, const c
  * @since_tizen 6.5
  * @remarks Call this function within webrtc_track_added_cb(), otherwise #WEBRTC_ERROR_INVALID_OPERATION will be returned.\n
  *          If webrtc_set_encoded_audio_frame_cb() has been called, it will return #WEBRTC_ERROR_INVALID_OPERATION.\n
- *          The following sound stream types can be used for the @a stream_info :\n
+ *          The following sound stream types can be used to create the @a stream_info :\n
  *          #SOUND_STREAM_TYPE_MEDIA\n
  *          #SOUND_STREAM_TYPE_VOIP\n
- *          #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY
+ *          #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY\n
+ *          For more details, please refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE.
  * @param[in] webrtc      WebRTC handle
  * @param[in] track_id    The track id
  * @param[in] stream_info The sound stream information
@@ -1138,10 +1153,11 @@ int webrtc_unset_encoded_video_frame_cb(webrtc_h webrtc);
  *          #WEBRTC_MEDIA_SOURCE_TYPE_MIC\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_FILE
  * @since_tizen 6.5
- * @remarks The following sound stream types can be used for the @a stream_info :\n
+ * @remarks The following sound stream types can be used to create the @a stream_info :\n
  *          #SOUND_STREAM_TYPE_MEDIA\n
  *          #SOUND_STREAM_TYPE_VOIP\n
- *          #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY
+ *          #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY\n
+ *          For more details, please refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE.
  * @param[in] webrtc      WebRTC handle
  * @param[in] source_id   The audio source id
  * @param[in] stream_info The sound stream information
index 6108f961e7e416469b339774000e3a7ad081e37b..9fe045cfde363dc1649102fc951f57293c90b0da 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.57
+Version:    0.2.58
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 502217c5e58655be17d195ccbe87545eca778951..429837f07581852315133f0350d5932d95f232ce 100644 (file)
@@ -2001,23 +2001,6 @@ exit:
        return ret;
 }
 
-static GstCaps *__make_encoded_caps_for_appsrc(webrtc_gst_slot_s *source)
-{
-       media_format_mimetype_e mime_type;
-       const char *_media_type;
-
-       RET_VAL_IF(source == NULL, NULL, "source is NULL");
-       RET_VAL_IF(source->media_format == NULL, NULL, "media_format is NULL");
-       RET_VAL_IF(source->type != WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, NULL, "invalid media source type(%d)", source->type);
-       RET_VAL_IF(media_format_get_video_info(source->media_format, &mime_type, NULL, NULL, NULL, NULL) != MEDIA_FORMAT_ERROR_NONE,
-                               NULL, "failed to media_format_get_video_info()");
-
-       _media_type = __get_video_media_type(__get_video_format_name(mime_type, source->zerocopy_enabled));
-       RET_VAL_IF(g_strcmp0(_media_type, MEDIA_TYPE_VIDEO_H264), NULL, "not supported type(%s)", _media_type);
-
-       return __make_encoded_caps_from_media_format(source, NULL);
-}
-
 static int __complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrtc_gst_slot_s *source)
 {
        int ret = WEBRTC_ERROR_NONE;
@@ -2031,6 +2014,7 @@ static int __complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrt
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
        RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
+       RET_VAL_IF(source->media_format == NULL, WEBRTC_ERROR_INVALID_OPERATION, "media_format is NULL");
 
        src_pad = (source->media_types == MEDIA_TYPE_AUDIO) ? &source->av[AV_IDX_AUDIO].src_pad : &source->av[AV_IDX_VIDEO].src_pad;
        ret = _add_no_target_ghostpad_to_slot(source, true, src_pad);
@@ -2042,7 +2026,7 @@ static int __complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrt
        if ((ret = __create_rest_of_elements_for_encoded_format(webrtc, source, &payloader, &queue, &capsfilter)) != WEBRTC_ERROR_NONE)
                return ret;
 
-       if (!(sink_caps = __make_encoded_caps_for_appsrc(source))) {
+       if (!(sink_caps = __make_encoded_caps_from_media_format(source, NULL))) {
                LOG_ERROR("failed to __make_encoded_caps_for_appsrc()");
                return WEBRTC_ERROR_INVALID_OPERATION;
        }