static int __mm_wfd_sink_destroy_video_sinkbin(mm_wfd_sink_t *wfd_sink);
static int __mm_wfd_sink_destroy_pipeline(mm_wfd_sink_t *wfd_sink);
static int __mm_wfd_sink_set_pipeline_state(mm_wfd_sink_t *wfd_sink, GstState state, gboolean async);
+static gboolean _mm_wfd_sink_msg_callback(GstBus *bus, GstMessage *msg, gpointer data);
/* state */
static int __mm_wfd_sink_set_state(mm_wfd_sink_t *wfd_sink, MMWFDSinkStateType state);
break;
case GST_MESSAGE_STATE_CHANGED:
/* we only handle state change messages from pipeline */
- if (!GST_IS_PIPELINE(GST_MESSAGE_SRC(message)))
- ret = GST_BUS_DROP;
+ if (GST_IS_PIPELINE(GST_MESSAGE_SRC(message)))
+ _mm_wfd_sink_msg_callback(bus, message, data);
+
+ ret = GST_BUS_DROP;
break;
case GST_MESSAGE_ASYNC_DONE:
- if (!GST_IS_PIPELINE(GST_MESSAGE_SRC(message)))
- ret = GST_BUS_DROP;
+ if (GST_IS_PIPELINE(GST_MESSAGE_SRC(message)))
+ _mm_wfd_sink_msg_callback(bus, message, data);
+
+ ret = GST_BUS_DROP;
break;
default:
break;
}
+ if (ret == GST_BUS_DROP) {
+ gst_message_unref(message);
+ message = NULL;
+ }
+
return ret;
}
MMWFDSinkStreamInfo *stream_info = NULL;
gint is_valid_audio_format = FALSE;
gint is_valid_video_format = FALSE;
- gint audio_codec = MM_WFD_SINK_AUDIO_CODEC_NONE;
- gint video_codec = MM_WFD_SINK_VIDEO_CODEC_NONE;
gchar *audio_format;
gchar *video_format;
stream_info = &wfd_sink->stream_info;
- audio_codec = wfd_sink->stream_info.audio_stream_info.codec;
- video_codec = wfd_sink->stream_info.video_stream_info.codec;
-
if (gst_structure_has_field(str, "audio_format")) {
is_valid_audio_format = TRUE;
audio_format = g_strdup(gst_structure_get_string(str, "audio_format"));
if (gst_structure_has_field(str, "audio_bitwidth"))
gst_structure_get_int(str, "audio_bitwidth", &stream_info->audio_stream_info.bitwidth);
- if (audio_codec != MM_WFD_SINK_AUDIO_CODEC_NONE) {
- if (audio_codec != stream_info->audio_stream_info.codec)
- wfd_sink_debug("audio codec is changed...need to change audio decodebin");
- } else {
- WFD_SINK_MANAGER_APPEND_CMD(wfd_sink, WFD_SINK_MANAGER_CMD_PREPARE_A_PIPELINE);
- }
+ WFD_SINK_MANAGER_APPEND_CMD(wfd_sink, WFD_SINK_MANAGER_CMD_PREPARE_A_PIPELINE);
wfd_sink_debug("audio_format : %s \n \t rate : %d \n \t channels : %d \n \t bitwidth : %d \n \t \n",
audio_format,
if (gst_structure_has_field(str, "video_framerate"))
gst_structure_get_int(str, "video_framerate", &stream_info->video_stream_info.frame_rate);
- if (video_codec != MM_WFD_SINK_AUDIO_CODEC_NONE) {
- if (video_codec != stream_info->video_stream_info.codec)
- wfd_sink_debug("video codec is changed...need to change video decodebin");
- } else {
- WFD_SINK_MANAGER_APPEND_CMD(wfd_sink, WFD_SINK_MANAGER_CMD_PREPARE_V_PIPELINE);
- }
+ WFD_SINK_MANAGER_APPEND_CMD(wfd_sink, WFD_SINK_MANAGER_CMD_PREPARE_V_PIPELINE);
wfd_sink_debug("video_format : %s \n \t width : %d \n \t height : %d \n \t frame_rate : %d \n \t",
video_format,
return MM_ERROR_NONE;
}
-static void __mm_wfd_sink_queue_overrun(GstElement *element, gpointer u_data)
+static void __mm_wfd_sink_queue_overrun(GstElement *queue, gpointer u_data)
{
+ guint64 time = 0;
+
wfd_sink_debug_fenter();
- return_if_fail(element);
+ return_if_fail(queue);
+
+ g_object_get(G_OBJECT(queue), "current-level-time", &time, NULL);
- wfd_sink_warning("%s is overrun",
- GST_STR_NULL(GST_ELEMENT_NAME(element)));
+ wfd_sink_warning("%s is overrun(%" GST_TIME_FORMAT")",
+ GST_ELEMENT_NAME(queue), GST_TIME_ARGS(time));
wfd_sink_debug_fleave();
/* create queue */
MMWFDSINK_CREATE_ELEMENT(a_decodebin, WFD_SINK_A_D_QUEUE, "queue", "audio_queue", FALSE);
MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_decodebin[WFD_SINK_A_D_QUEUE].gst, "sink");
+ MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_decodebin[WFD_SINK_A_D_QUEUE].gst, "src");
if (a_decodebin[WFD_SINK_A_D_QUEUE].gst)
__mm_wfd_sink_prepare_queue(wfd_sink, a_decodebin[WFD_SINK_A_D_QUEUE].gst);
/* create hdcp */
MMWFDSINK_CREATE_ELEMENT(a_decodebin, WFD_SINK_A_D_HDCP, wfd_sink->ini.name_of_audio_hdcp, "audio_hdcp", FALSE);
MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_decodebin[WFD_SINK_A_D_HDCP].gst, "sink");
+ MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_decodebin[WFD_SINK_A_D_HDCP].gst, "src");
/* create codec */
audio_codec = wfd_sink->ini.wfd_audio_codecs.audio_codec;
/* create queue */
MMWFDSINK_CREATE_ELEMENT(v_decodebin, WFD_SINK_V_D_QUEUE, "queue", "video_queue", FALSE);
MMWFDSINK_PAD_PROBE(wfd_sink, NULL, v_decodebin[WFD_SINK_V_D_QUEUE].gst, "sink");
+ MMWFDSINK_PAD_PROBE(wfd_sink, NULL, v_decodebin[WFD_SINK_V_D_QUEUE].gst, "src");
if (v_decodebin[WFD_SINK_V_D_QUEUE].gst)
__mm_wfd_sink_prepare_queue(wfd_sink, v_decodebin[WFD_SINK_V_D_QUEUE].gst);
static int __mm_wfd_sink_destroy_pipeline(mm_wfd_sink_t *wfd_sink)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+ GstBus *bus = NULL;
wfd_sink_debug_fenter();
MMWFDSinkGstElement *mainbin = wfd_sink->pipeline->mainbin;
if (mainbin) {
+
+ PRINT_WFD_REF_COUNT(wfd_sink);
+
ret = gst_element_set_state(mainbin[WFD_SINK_M_PIPE].gst, GST_STATE_NULL);
if (ret != GST_STATE_CHANGE_SUCCESS) {
wfd_sink_error("failed to change state of pipeline to NULL");
wfd_sink_debug("Successed to change state of pipeline to NULL");
}
+ bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[WFD_SINK_M_PIPE].gst));
+ if (bus) {
+ GstMessage *gst_msg = NULL;
+ while ((gst_msg = gst_bus_pop(bus)) != NULL) {
+ _mm_wfd_sink_msg_callback(bus, gst_msg, (gpointer)wfd_sink);
+ gst_message_unref(gst_msg);
+ gst_msg = NULL;
+ }
+ gst_object_unref(bus);
+ bus = NULL;
+ }
+
+ PRINT_WFD_REF_COUNT(wfd_sink);
+
if (MM_ERROR_NONE != __mm_wfd_sink_destroy_video_decodebin(wfd_sink)) {
wfd_sink_error("failed to destroy video decodebin");
return MM_ERROR_WFD_INTERNAL;