{
GstCaps *caps;
const char *_media_type;
+ media_format_mimetype_e mime_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 type[%d]", source->type);
- switch (source->type) {
- case WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET: {
- media_format_mimetype_e mime_type;
-
- if (source->media_types == MEDIA_TYPE_AUDIO) {
- int channels;
- int samplerate;
-
- RET_VAL_IF(media_format_get_audio_info(source->media_format, &mime_type, &channels, &samplerate, NULL, NULL) != MEDIA_FORMAT_ERROR_NONE,
- NULL, "failed to media_format_get_audio_info()");
+ if (source->media_types == MEDIA_TYPE_AUDIO) {
+ int channels;
+ int samplerate;
- _media_type = _get_audio_media_type(source->av[AV_IDX_AUDIO].codec);
- RET_VAL_IF(_media_type == NULL, NULL, "media_type is NULL");
+ RET_VAL_IF(media_format_get_audio_info(source->media_format, &mime_type, &channels, &samplerate, NULL, NULL) != MEDIA_FORMAT_ERROR_NONE,
+ NULL, "failed to media_format_get_audio_info()");
- caps = _get_caps_from_encoded_audio_media_type(_media_type, channels, samplerate);
+ _media_type = _get_audio_media_type(source->av[AV_IDX_AUDIO].codec);
+ RET_VAL_IF(_media_type == NULL, NULL, "media_type is NULL");
- } else if (source->media_types == MEDIA_TYPE_VIDEO) {
- int width;
- int height;
- int framerate;
+ caps = _get_caps_from_encoded_audio_media_type(_media_type, channels, samplerate);
- RET_VAL_IF(media_format_get_video_info(source->media_format, &mime_type, &width, &height, NULL, NULL) != MEDIA_FORMAT_ERROR_NONE,
- NULL, "failed to media_format_get_video_info()");
- RET_VAL_IF(media_format_get_video_frame_rate(source->media_format, &framerate) != MEDIA_FORMAT_ERROR_NONE,
- NULL, "failed to media_format_get_video_frame_rate()");
+ } else if (source->media_types == MEDIA_TYPE_VIDEO) {
+ int width;
+ int height;
+ int framerate;
- _media_type = _get_video_media_type(source->av[AV_IDX_VIDEO].codec);
- RET_VAL_IF(_media_type == NULL, NULL, "media_type is NULL");
+ RET_VAL_IF(media_format_get_video_info(source->media_format, &mime_type, &width, &height, NULL, NULL) != MEDIA_FORMAT_ERROR_NONE,
+ NULL, "failed to media_format_get_video_info()");
+ RET_VAL_IF(media_format_get_video_frame_rate(source->media_format, &framerate) != MEDIA_FORMAT_ERROR_NONE,
+ NULL, "failed to media_format_get_video_frame_rate()");
- caps = _get_caps_from_encoded_video_media_type(_media_type, width, height);
+ _media_type = _get_video_media_type(source->av[AV_IDX_VIDEO].codec);
+ RET_VAL_IF(_media_type == NULL, NULL, "media_type is NULL");
- } else {
- LOG_ERROR_IF_REACHED("source->media_types(0x%x)", source->media_types);
- return NULL;
- }
- break;
- }
+ caps = _get_caps_from_encoded_video_media_type(_media_type, width, height);
- default:
- LOG_ERROR_IF_REACHED("type(%d)", source->type);
+ } else {
+ LOG_ERROR_IF_REACHED("source->media_types(0x%x)", source->media_types);
return NULL;
}
return caps;
}
-//LCOV_EXCL_STOP
-//LCOV_EXCL_START
static int __create_rest_of_elements_for_encoded_format(webrtc_s *webrtc, webrtc_gst_slot_s *source,
GList **element_list)
{
goto error;
APPEND_ELEMENT(*element_list, capsfilter);
- if(_set_payload_type(webrtc, source, GET_AV_IDX_BY_TYPE(source->media_types), NULL) != WEBRTC_ERROR_NONE)
+ if (_set_payload_type(webrtc, source, GET_AV_IDX_BY_TYPE(source->media_types), NULL) != WEBRTC_ERROR_NONE)
goto error;
if ((sink_caps = _make_rtp_caps(media_type, source->av[GET_AV_IDX_BY_TYPE(source->media_types)].pt, source, NULL))) {
media_format_ref(format);
source->media_format = format;
- if((ret = __set_mediapacketsrc_codec_info(webrtc, source, mime_type)) != WEBRTC_ERROR_NONE)
+ if ((ret = __set_mediapacketsrc_codec_info(webrtc, source, mime_type)) != WEBRTC_ERROR_NONE)
goto error;
if ((mime_type & MEDIA_FORMAT_RAW) &&
_width = output_width - (left + right);
_height = output_height - (top + bottom);
- if((ret = _update_caps_for_render_with_resolution(source, _width, _height)) != WEBRTC_ERROR_NONE)
+ if ((ret = _update_caps_for_render_with_resolution(source, _width, _height)) != WEBRTC_ERROR_NONE)
return ret;
_set_video_src_resolution(source, _width, _height);
{
webrtc_gst_slot_s *source = NULL;
GstElement *videocrop = NULL;
- GstElement *screen_source = NULL;
int ret;
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
RET_VAL_IF(source->type != WEBRTC_MEDIA_SOURCE_TYPE_SCREEN, WEBRTC_ERROR_INVALID_PARAMETER, "source type is not screen");
RET_VAL_IF(!_is_screen_source_cropped(source), WEBRTC_ERROR_INVALID_OPERATION, "source is not cropped");
- screen_source = gst_bin_get_by_name(source->bin, ELEMENT_NAME_SCREENSRC);
- RET_VAL_IF(screen_source == NULL, WEBRTC_ERROR_INVALID_OPERATION, "sreen_source is NULL");
-
videocrop = gst_bin_get_by_name(source->bin, ELEMENT_NAME_VIDEOCROP);
RET_VAL_IF(videocrop == NULL, WEBRTC_ERROR_INVALID_OPERATION, "videocrop is NULL");
"bottom", 0,
NULL);
- if((ret = _update_caps_for_render_with_resolution(source, source->video_info.origin_width, source->video_info.origin_height)) != WEBRTC_ERROR_NONE)
+ if ((ret = _update_caps_for_render_with_resolution(source, source->video_info.origin_width, source->video_info.origin_height)) != WEBRTC_ERROR_NONE)
return ret;
_set_video_src_resolution(source, source->video_info.origin_width, source->video_info.origin_height);