const gchar* name = NULL;
MMPlayerTrackType stream_type = MM_PLAYER_TRACK_TYPE_VIDEO;
- if (GST_EVENT_TYPE(event) != GST_EVENT_STREAM_START &&
- GST_EVENT_TYPE(event) != GST_EVENT_FLUSH_STOP &&
- GST_EVENT_TYPE(event) != GST_EVENT_SEGMENT &&
- GST_EVENT_TYPE(event) != GST_EVENT_EOS)
- return ret;
+
+ if (GST_EVENT_IS_DOWNSTREAM(event)) {
+ if (GST_EVENT_TYPE(event) != GST_EVENT_STREAM_START &&
+ GST_EVENT_TYPE(event) != GST_EVENT_FLUSH_STOP &&
+ GST_EVENT_TYPE(event) != GST_EVENT_SEGMENT &&
+ GST_EVENT_TYPE(event) != GST_EVENT_EOS)
+ return ret;
+ } else if (GST_EVENT_IS_UPSTREAM(event)) {
+ if (GST_EVENT_TYPE(event) != GST_EVENT_QOS)
+ return ret;
+ }
caps = gst_pad_query_caps(pad, NULL);
if (!caps) {
case GST_EVENT_EOS:
{
/* in case of gapless, drop eos event not to send it to sink */
- if (player->gapless.reconfigure) {
+ if (player->gapless.reconfigure && !player->msg_posted) {
LOGD("%s:%s EOS received but will be drop", GST_DEBUG_PAD_NAME(pad));
ret = GST_PAD_PROBE_DROP;
}
}
break;
}
+ case GST_EVENT_QOS:
+ {
+ gdouble proportion = 0.0;
+ GstClockTimeDiff diff = 0;
+ GstClockTime timestamp = 0;
+ gint64 running_time_diff = -1;
+ GstQOSType type = 0;
+ GstEvent *tmpev = NULL;
+
+ running_time_diff = player->gapless.segment[stream_type].base;
+
+ if (running_time_diff <= 0) /* don't need to adjust */
+ break;
+
+ gst_event_parse_qos(event, &type, &proportion, &diff, ×tamp);
+ gst_event_unref(event);
+
+ if (timestamp < running_time_diff) {
+ LOGW("QOS event from previous group");
+ ret = GST_PAD_PROBE_DROP;
+ break;
+ }
+
+ LOGD("Adjusting QOS event: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT " = %"
+ GST_TIME_FORMAT, GST_TIME_ARGS(timestamp),
+ GST_TIME_ARGS(running_time_diff),
+ GST_TIME_ARGS(timestamp - running_time_diff));
+
+ timestamp -= running_time_diff;
+
+ /* That case is invalid for QoS events */
+ if (diff < 0 && -diff > timestamp) {
+ LOGW("QOS event from previous group");
+ ret = GST_PAD_PROBE_DROP;
+ break;
+ }
+
+ tmpev = gst_event_new_qos(GST_QOS_TYPE_UNDERFLOW, proportion, diff, timestamp);
+ GST_PAD_PROBE_INFO_DATA(info) = tmpev;
+
+ break;
+ }
default:
break;
}
LOGD("blocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
player->selector[stream_type].block_id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
__mmplayer_gst_selector_blocked, NULL, NULL);
- player->selector[stream_type].event_probe_id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM|GST_PAD_PROBE_TYPE_EVENT_FLUSH,
+ player->selector[stream_type].event_probe_id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH|GST_PAD_PROBE_TYPE_EVENT_FLUSH,
__mmplayer_gst_selector_event_probe, player, NULL);
gst_element_set_state(selector, GST_STATE_PAUSED);
iter = gst_element_iterate_src_pads(player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst);
while (!done) {
- switch (gst_iterator_next (iter, &item)) {
+ switch (gst_iterator_next(iter, &item)) {
case GST_ITERATOR_OK:
- pad = g_value_get_object (&item);
+ pad = g_value_get_object(&item);
if (!GST_PAD_IS_EOS(pad)) {
LOGW("[%s:%s] not received EOS yet.", GST_DEBUG_PAD_NAME(pad));
is_all_drained = FALSE;
break;
}
- g_value_reset (&item);
+ g_value_reset(&item);
break;
case GST_ITERATOR_RESYNC:
- gst_iterator_resync (iter);
+ gst_iterator_resync(iter);
break;
case GST_ITERATOR_ERROR:
case GST_ITERATOR_DONE:
break;
}
}
- g_value_unset (&item);
- gst_iterator_free (iter);
+ g_value_unset(&item);
+ gst_iterator_free(iter);
if (!is_all_drained) {
LOGD("Wait util the all pads get EOS.");