case MEDIA_FORMAT_VP9:
return "VP9";
case MEDIA_FORMAT_H264_SP: /* baseline profile */
+ case MEDIA_FORMAT_H264_MP: /* main profile */
+ case MEDIA_FORMAT_H264_HP: /* high profile */
return "H264";
default:
LOG_ERROR("not supported mime_type(0x%x)", mime_type);
case MEDIA_FORMAT_VP8:
case MEDIA_FORMAT_VP9:
case MEDIA_FORMAT_H264_SP:
+ case MEDIA_FORMAT_H264_MP:
+ case MEDIA_FORMAT_H264_HP:
LOG_INFO("[%s][ENCODED/%s] mime_type[0x%x]", mime_type & MEDIA_FORMAT_AUDIO ? "AUDIO" : "VIDEO",
__get_format_name(mime_type), mime_type);
return true;
return _set_ghost_pad_target(source->src_pad, capsfilter, true);
}
+static GstCaps *__make_encoded_caps_for_appsrc(webrtc_gst_slot_s *source)
+{
+ GstCaps *caps;
+ 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_format_name(mime_type));
+ RET_VAL_IF(g_strcmp0(_media_type, MEDIA_TYPE_VIDEO_H264), NULL, "not supported type(%s)", _media_type);
+ /* FIXME: prepare other types */
+
+ caps = gst_caps_new_simple(_media_type,
+ "stream-format", G_TYPE_STRING, "byte-stream",
+ "alignment", G_TYPE_STRING, "au",
+ NULL);
+
+ return caps;
+}
+
static int __complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrtc_gst_slot_s *source)
{
int ret = WEBRTC_ERROR_NONE;
appsrc = __find_element_in_bin(source->bin, "appsrc");
RET_VAL_IF(appsrc == NULL, WEBRTC_ERROR_INVALID_OPERATION, "appsrc is NULL");
- if (!(sink_caps = __make_encoded_caps_from_media_format(source, NULL))) {
- LOG_ERROR("failed to __make_encoded_caps_from_media_format()");
+ if (!(sink_caps = __make_encoded_caps_for_appsrc(source))) {
+ LOG_ERROR("failed to __make_encoded_caps_for_appsrc()");
return WEBRTC_ERROR_INVALID_OPERATION;
}
caps_str = gst_caps_to_string(sink_caps);
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
RET_VAL_IF(format == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "format is NULL");
RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source");
- RET_VAL_IF(!__find_element_in_bin(source->bin, "appsrc"), WEBRTC_ERROR_INVALID_PARAMETER, "source_id[%u] is not for media packet source", source_id);
+ RET_VAL_IF(source->type != WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, WEBRTC_ERROR_INVALID_PARAMETER, "invalid media source type(%d)", source->type);
RET_VAL_IF(source->media_format != NULL, WEBRTC_ERROR_INVALID_OPERATION, "format is already set to this media packet source");
RET_VAL_IF(media_format_get_type(format, &format_type) != MEDIA_FORMAT_ERROR_NONE, WEBRTC_ERROR_INVALID_OPERATION,
GstElement *appsrc;
GstBuffer *new_buffer;
guint64 pts = 0;
+ guint64 dts = 0;
guint64 duration = 0;
guint64 size = 0;
GstFlowReturn gst_ret = GST_FLOW_OK;
media_packet_get_pts(packet, &pts);
GST_BUFFER_PTS(new_buffer) = pts;
+ media_packet_get_dts(packet, &dts);
+ GST_BUFFER_DTS(new_buffer) = dts;
media_packet_get_duration(packet, &duration);
GST_BUFFER_DURATION(new_buffer) = duration;
- LOG_DEBUG("new gst buffer[%p, pts:%llu, duration:%llu]", new_buffer, pts, duration);
+ LOG_DEBUG("new gst buffer[%p, pts:%llu, dts:%llu, duration:%llu]", new_buffer, pts, dts, duration);
g_signal_emit_by_name(G_OBJECT(appsrc), "push-buffer", new_buffer, &gst_ret, NULL);
gst_buffer_unref(new_buffer);