Lines Matching refs:mq
198 static void wake_up_next_non_linked (GstMultiQueue * mq);
199 static void compute_high_id (GstMultiQueue * mq);
200 static void compute_high_time (GstMultiQueue * mq, guint groupid);
204 static void update_buffering (GstMultiQueue * mq, GstSingleQueue * sq);
205 static void gst_multi_queue_post_buffering (GstMultiQueue * mq);
206 static void recheck_buffering_status (GstMultiQueue * mq);
210 static void calculate_interleave (GstMultiQueue * mq, GstSingleQueue * sq);
344 #define SET_PERCENT(mq, perc) G_STMT_START { \ argument
345 if (perc != mq->buffering_percent) { \
346 mq->buffering_percent = perc; \
347 mq->buffering_percent_changed = TRUE; \
348 GST_DEBUG_OBJECT (mq, "buffering %d percent", perc); \
372 GstMultiQueue *mq; in gst_multiqueue_pad_get_group_id() local
377 mq = g_weak_ref_get (&pad->sq->mqueue); in gst_multiqueue_pad_get_group_id()
379 if (mq) { in gst_multiqueue_pad_get_group_id()
380 GST_OBJECT_LOCK (mq); in gst_multiqueue_pad_get_group_id()
385 if (mq) { in gst_multiqueue_pad_get_group_id()
386 GST_OBJECT_UNLOCK (mq); in gst_multiqueue_pad_get_group_id()
387 gst_object_unref (mq); in gst_multiqueue_pad_get_group_id()
398 GstMultiQueue *mq; in gst_multiqueue_pad_get_current_level_buffers() local
403 mq = g_weak_ref_get (&pad->sq->mqueue); in gst_multiqueue_pad_get_current_level_buffers()
405 if (mq) { in gst_multiqueue_pad_get_current_level_buffers()
406 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multiqueue_pad_get_current_level_buffers()
411 if (mq) { in gst_multiqueue_pad_get_current_level_buffers()
412 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multiqueue_pad_get_current_level_buffers()
413 gst_object_unref (mq); in gst_multiqueue_pad_get_current_level_buffers()
424 GstMultiQueue *mq; in gst_multiqueue_pad_get_current_level_bytes() local
429 mq = g_weak_ref_get (&pad->sq->mqueue); in gst_multiqueue_pad_get_current_level_bytes()
431 if (mq) { in gst_multiqueue_pad_get_current_level_bytes()
432 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multiqueue_pad_get_current_level_bytes()
437 if (mq) { in gst_multiqueue_pad_get_current_level_bytes()
438 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multiqueue_pad_get_current_level_bytes()
439 gst_object_unref (mq); in gst_multiqueue_pad_get_current_level_bytes()
449 GstMultiQueue *mq; in gst_multiqueue_pad_get_current_level_time() local
455 mq = g_weak_ref_get (&pad->sq->mqueue); in gst_multiqueue_pad_get_current_level_time()
457 if (mq) { in gst_multiqueue_pad_get_current_level_time()
458 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multiqueue_pad_get_current_level_time()
463 if (mq) { in gst_multiqueue_pad_get_current_level_time()
464 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multiqueue_pad_get_current_level_time()
465 gst_object_unref (mq); in gst_multiqueue_pad_get_current_level_time()
926 #define SET_CHILD_PROPERTY(mq,format) G_STMT_START { \ argument
927 GList * tmp = mq->queues; \
930 q->max_size.format = mq->max_size.format; \
931 update_buffering (mq, q); \
941 GstMultiQueue *mq = GST_MULTI_QUEUE (object); in gst_multi_queue_set_property() local
945 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_set_property()
946 mq->max_size.bytes = g_value_get_uint (value); in gst_multi_queue_set_property()
947 SET_CHILD_PROPERTY (mq, bytes); in gst_multi_queue_set_property()
948 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_set_property()
949 gst_multi_queue_post_buffering (mq); in gst_multi_queue_set_property()
956 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_set_property()
958 mq->max_size.visible = new_size; in gst_multi_queue_set_property()
960 tmp = mq->queues; in gst_multi_queue_set_property()
966 GST_DEBUG_OBJECT (mq, "Queue %d: Requested buffers size: %d," in gst_multi_queue_set_property()
979 update_buffering (mq, q); in gst_multi_queue_set_property()
984 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_set_property()
985 gst_multi_queue_post_buffering (mq); in gst_multi_queue_set_property()
990 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_set_property()
991 mq->max_size.time = g_value_get_uint64 (value); in gst_multi_queue_set_property()
994 mq->buffering_time = mq->max_size.time; in gst_multi_queue_set_property()
996 SET_CHILD_PROPERTY (mq, time); in gst_multi_queue_set_property()
997 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_set_property()
998 gst_multi_queue_post_buffering (mq); in gst_multi_queue_set_property()
1001 mq->extra_size.bytes = g_value_get_uint (value); in gst_multi_queue_set_property()
1004 mq->extra_size.visible = g_value_get_uint (value); in gst_multi_queue_set_property()
1007 mq->extra_size.time = g_value_get_uint64 (value); in gst_multi_queue_set_property()
1010 mq->use_buffering = g_value_get_boolean (value); in gst_multi_queue_set_property()
1011 recheck_buffering_status (mq); in gst_multi_queue_set_property()
1014 mq->low_watermark = g_value_get_int (value) * BUF_LEVEL_PERCENT_FACTOR; in gst_multi_queue_set_property()
1019 recheck_buffering_status (mq); in gst_multi_queue_set_property()
1022 mq->high_watermark = g_value_get_int (value) * BUF_LEVEL_PERCENT_FACTOR; in gst_multi_queue_set_property()
1023 recheck_buffering_status (mq); in gst_multi_queue_set_property()
1026 mq->low_watermark = g_value_get_double (value) * MAX_BUFFERING_LEVEL; in gst_multi_queue_set_property()
1027 recheck_buffering_status (mq); in gst_multi_queue_set_property()
1032 mq->mq_num_id = g_value_get_uint (value); in gst_multi_queue_set_property()
1036 mq->high_watermark = g_value_get_double (value) * MAX_BUFFERING_LEVEL; in gst_multi_queue_set_property()
1037 recheck_buffering_status (mq); in gst_multi_queue_set_property()
1040 mq->sync_by_running_time = g_value_get_boolean (value); in gst_multi_queue_set_property()
1043 mq->use_interleave = g_value_get_boolean (value); in gst_multi_queue_set_property()
1046 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_set_property()
1047 mq->unlinked_cache_time = g_value_get_uint64 (value); in gst_multi_queue_set_property()
1048 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_set_property()
1049 gst_multi_queue_post_buffering (mq); in gst_multi_queue_set_property()
1052 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_set_property()
1053 mq->min_interleave_time = g_value_get_uint64 (value); in gst_multi_queue_set_property()
1054 if (mq->use_interleave) in gst_multi_queue_set_property()
1055 calculate_interleave (mq, NULL); in gst_multi_queue_set_property()
1056 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_set_property()
1066 gst_multi_queue_get_stats (GstMultiQueue * mq) in gst_multi_queue_get_stats() argument
1073 if (mq->queues != NULL) { in gst_multi_queue_get_stats()
1079 for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { in gst_multi_queue_get_stats()
1106 GstMultiQueue *mq = GST_MULTI_QUEUE (object); in gst_multi_queue_get_property() local
1108 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_get_property()
1112 g_value_set_uint (value, mq->extra_size.bytes); in gst_multi_queue_get_property()
1115 g_value_set_uint (value, mq->extra_size.visible); in gst_multi_queue_get_property()
1118 g_value_set_uint64 (value, mq->extra_size.time); in gst_multi_queue_get_property()
1121 g_value_set_uint (value, mq->max_size.bytes); in gst_multi_queue_get_property()
1124 g_value_set_uint (value, mq->max_size.visible); in gst_multi_queue_get_property()
1127 g_value_set_uint64 (value, mq->max_size.time); in gst_multi_queue_get_property()
1130 g_value_set_boolean (value, mq->use_buffering); in gst_multi_queue_get_property()
1133 g_value_set_int (value, mq->low_watermark / BUF_LEVEL_PERCENT_FACTOR); in gst_multi_queue_get_property()
1136 g_value_set_int (value, mq->high_watermark / BUF_LEVEL_PERCENT_FACTOR); in gst_multi_queue_get_property()
1139 g_value_set_double (value, mq->low_watermark / in gst_multi_queue_get_property()
1143 g_value_set_double (value, mq->high_watermark / in gst_multi_queue_get_property()
1147 g_value_set_boolean (value, mq->sync_by_running_time); in gst_multi_queue_get_property()
1150 g_value_set_boolean (value, mq->use_interleave); in gst_multi_queue_get_property()
1153 g_value_set_uint64 (value, mq->unlinked_cache_time); in gst_multi_queue_get_property()
1156 g_value_set_uint64 (value, mq->min_interleave_time); in gst_multi_queue_get_property()
1159 g_value_take_boxed (value, gst_multi_queue_get_stats (mq)); in gst_multi_queue_get_property()
1166 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_get_property()
1175 GstMultiQueue *mq = GST_MULTI_QUEUE (parent); in gst_multi_queue_iterate_internal_links() local
1178 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_iterate_internal_links()
1207 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_iterate_internal_links()
1354 gst_single_queue_start (GstMultiQueue * mq, GstSingleQueue * sq) in gst_single_queue_start() argument
1359 GST_LOG_OBJECT (mq, "SingleQueue %d : starting task", sq->id); in gst_single_queue_start()
1371 gst_single_queue_pause (GstMultiQueue * mq, GstSingleQueue * sq) in gst_single_queue_pause() argument
1376 GST_LOG_OBJECT (mq, "SingleQueue %d : pausing task", sq->id); in gst_single_queue_pause()
1387 gst_single_queue_stop (GstMultiQueue * mq, GstSingleQueue * sq) in gst_single_queue_stop() argument
1392 GST_LOG_OBJECT (mq, "SingleQueue %d : stopping task", sq->id); in gst_single_queue_stop()
1402 gst_single_queue_flush (GstMultiQueue * mq, GstSingleQueue * sq, gboolean flush, in gst_single_queue_flush() argument
1405 GST_DEBUG_OBJECT (mq, "flush %s queue %d", (flush ? "start" : "stop"), in gst_single_queue_flush()
1409 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_single_queue_flush()
1416 GST_LOG_OBJECT (mq, "SingleQueue %d : waking up eventually waiting task", in gst_single_queue_flush()
1421 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_single_queue_flush()
1425 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_single_queue_flush()
1433 sq->max_size.visible = mq->max_size.visible; in gst_single_queue_flush()
1449 mq->high_time = GST_CLOCK_STIME_NONE; in gst_single_queue_flush()
1452 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_single_queue_flush()
1458 get_buffering_level (GstMultiQueue * mq, GstSingleQueue * sq) in get_buffering_level() argument
1465 GST_DEBUG_OBJECT (mq, in get_buffering_level()
1496 update_buffering_time (GstMultiQueue * mq) in update_buffering_time() argument
1499 GstClockTime buffering_time = mq->max_size.time; in update_buffering_time()
1500 for (iter = mq->queues; iter; iter = g_list_next (iter)) { in update_buffering_time()
1507 …GST_DEBUG_OBJECT (mq, "Going to post buffering: mq_num_id = %d, buffering_time = %" G_GUINT64_FORM… in update_buffering_time()
1508 mq->mq_num_id, mq->buffering_time, buffering_time); in update_buffering_time()
1509 mq->buffering_time = buffering_time; in update_buffering_time()
1510 if ((mq->buffering_time > (mq->last_buffering_time + DEFAULT_INTERNAL_BUFFERING_TIME)) || in update_buffering_time()
1511 (mq->last_buffering_time > (mq->buffering_time + DEFAULT_INTERNAL_BUFFERING_TIME))) { in update_buffering_time()
1512 mq->buffering_time_changed = TRUE; in update_buffering_time()
1513 mq->last_buffering_time = mq->buffering_time; in update_buffering_time()
1520 update_buffering (GstMultiQueue * mq, GstSingleQueue * sq) in update_buffering() argument
1525 if (!mq->use_buffering) in update_buffering()
1528 buffering_level = get_buffering_level (mq, sq); in update_buffering()
1532 percent = gst_util_uint64_scale (buffering_level, 100, mq->high_watermark); in update_buffering()
1537 if (mq->buffering) { in update_buffering()
1538 if (buffering_level >= mq->high_watermark) { in update_buffering()
1539 mq->buffering = FALSE; in update_buffering()
1542 percent = MAX (mq->buffering_percent, percent); in update_buffering()
1544 SET_PERCENT (mq, percent); in update_buffering()
1549 for (iter = mq->queues; iter; iter = g_list_next (iter)) { in update_buffering()
1552 if (get_buffering_level (mq, oq) >= mq->high_watermark) { in update_buffering()
1561 if (is_buffering && (buffering_level < mq->low_watermark || mq->buffering_percent == 0)) { in update_buffering()
1562 mq->buffering = TRUE; in update_buffering()
1563 SET_PERCENT (mq, percent); in update_buffering()
1566 if (is_buffering && buffering_level < mq->low_watermark) { in update_buffering()
1567 mq->buffering = TRUE; in update_buffering()
1568 SET_PERCENT (mq, percent); in update_buffering()
1575 update_buffering_time(mq); in update_buffering()
1580 gst_multi_queue_post_buffering (GstMultiQueue * mq) in gst_multi_queue_post_buffering() argument
1584 g_mutex_lock (&mq->buffering_post_lock); in gst_multi_queue_post_buffering()
1585 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_post_buffering()
1586 if (mq->buffering_percent_changed) { in gst_multi_queue_post_buffering()
1587 gint percent = mq->buffering_percent; in gst_multi_queue_post_buffering()
1589 mq->buffering_percent_changed = FALSE; in gst_multi_queue_post_buffering()
1591 GST_DEBUG_OBJECT (mq, "Going to post buffering: %d%%", percent); in gst_multi_queue_post_buffering()
1592 msg = gst_message_new_buffering (GST_OBJECT_CAST (mq), percent); in gst_multi_queue_post_buffering()
1598 if (mq->buffering_time_changed) { in gst_multi_queue_post_buffering()
1599 gint64 buffering_time = mq->buffering_time; in gst_multi_queue_post_buffering()
1600 mq->buffering_time_changed = FALSE; in gst_multi_queue_post_buffering()
1601 GST_DEBUG_OBJECT (mq, "Going to post buffering time: %" G_GUINT64_FORMAT, buffering_time); in gst_multi_queue_post_buffering()
1602 …msg_buffering_time = gst_message_new_buffering_time (GST_OBJECT_CAST (mq), buffering_time, mq->mq_… in gst_multi_queue_post_buffering()
1605 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_post_buffering()
1608 gst_element_post_message (GST_ELEMENT_CAST (mq), msg); in gst_multi_queue_post_buffering()
1613 gst_element_post_message (GST_ELEMENT_CAST (mq), msg_buffering_time); in gst_multi_queue_post_buffering()
1616 g_mutex_unlock (&mq->buffering_post_lock); in gst_multi_queue_post_buffering()
1620 recheck_buffering_status (GstMultiQueue * mq) in recheck_buffering_status() argument
1622 if (!mq->use_buffering && mq->buffering) { in recheck_buffering_status()
1623 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in recheck_buffering_status()
1624 mq->buffering = FALSE; in recheck_buffering_status()
1625 GST_DEBUG_OBJECT (mq, in recheck_buffering_status()
1628 SET_PERCENT (mq, 100); in recheck_buffering_status()
1629 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in recheck_buffering_status()
1632 if (mq->use_buffering) { in recheck_buffering_status()
1636 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in recheck_buffering_status()
1639 old_perc = mq->buffering_percent; in recheck_buffering_status()
1640 mq->buffering_percent = 0; in recheck_buffering_status()
1642 tmp = mq->queues; in recheck_buffering_status()
1645 update_buffering (mq, q); in recheck_buffering_status()
1650 GST_DEBUG_OBJECT (mq, in recheck_buffering_status()
1652 old_perc, mq->buffering_percent); in recheck_buffering_status()
1654 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in recheck_buffering_status()
1657 gst_multi_queue_post_buffering (mq); in recheck_buffering_status()
1661 calculate_interleave (GstMultiQueue * mq, GstSingleQueue * sq) in calculate_interleave() argument
1668 interleave = mq->interleave; in calculate_interleave()
1670 for (tmp = mq->queues; tmp; tmp = tmp->next) { in calculate_interleave()
1678 GST_LOG_OBJECT (mq, in calculate_interleave()
1680 mq->interleave = 5 * GST_SECOND; in calculate_interleave()
1682 mq->max_size.time = mq->interleave; in calculate_interleave()
1683 SET_CHILD_PROPERTY (mq, time); in calculate_interleave()
1700 GST_LOG_OBJECT (mq, in calculate_interleave()
1710 interleave = (150 * interleave / 100) + mq->min_interleave_time; in calculate_interleave()
1720 if (high == low || interleave > mq->interleave || in calculate_interleave()
1721 ((mq->last_interleave_update + (2 * MIN (GST_SECOND, in calculate_interleave()
1722 mq->interleave)) < low) in calculate_interleave()
1723 && interleave < (mq->interleave * 3 / 4))) { in calculate_interleave()
1725 mq->interleave = interleave; in calculate_interleave()
1726 mq->last_interleave_update = high; in calculate_interleave()
1728 mq->max_size.time = mq->interleave; in calculate_interleave()
1729 SET_CHILD_PROPERTY (mq, time); in calculate_interleave()
1734 GST_DEBUG_OBJECT (mq, in calculate_interleave()
1739 GST_TIME_ARGS (mq->interleave), in calculate_interleave()
1740 GST_STIME_ARGS (mq->last_interleave_update)); in calculate_interleave()
1748 update_time_level (GstMultiQueue * mq, GstSingleQueue * sq) in update_time_level() argument
1756 GST_DEBUG_OBJECT (mq, in update_time_level()
1771 if (mq->use_interleave) { in update_time_level()
1773 calculate_interleave (mq, sq); in update_time_level()
1807 GST_DEBUG_OBJECT (mq, in update_time_level()
1820 update_buffering (mq, sq); in update_time_level()
1828 apply_segment (GstMultiQueue * mq, GstSingleQueue * sq, GstEvent * event, in apply_segment() argument
1843 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in apply_segment()
1858 GST_DEBUG_OBJECT (mq, in apply_segment()
1862 update_time_level (mq, sq); in apply_segment()
1864 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in apply_segment()
1865 gst_multi_queue_post_buffering (mq); in apply_segment()
1870 apply_buffer (GstMultiQueue * mq, GstSingleQueue * sq, GstClockTime timestamp, in apply_buffer() argument
1873 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in apply_buffer()
1884 GST_DEBUG_OBJECT (mq, "queue %d, %s position updated to %" GST_TIME_FORMAT, in apply_buffer()
1896 update_time_level (mq, sq); in apply_buffer()
1897 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in apply_buffer()
1898 gst_multi_queue_post_buffering (mq); in apply_buffer()
1902 apply_gap (GstMultiQueue * mq, GstSingleQueue * sq, GstEvent * event, in apply_gap() argument
1908 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in apply_gap()
1918 GST_DEBUG_OBJECT (mq, "queue %d, %s position updated to %" GST_TIME_FORMAT, in apply_gap()
1930 update_time_level (mq, sq); in apply_gap()
1933 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in apply_gap()
1934 gst_multi_queue_post_buffering (mq); in apply_gap()
2000 gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq, in gst_single_queue_push_one() argument
2007 GST_INFO_OBJECT (mq, in gst_single_queue_push_one()
2020 apply_buffer (mq, sq, timestamp, duration, &sq->src_segment); in gst_single_queue_push_one()
2026 GST_DEBUG_OBJECT (mq, in gst_single_queue_push_one()
2031 GST_DEBUG_OBJECT (mq, in gst_single_queue_push_one()
2056 apply_segment (mq, sq, event, &sq->src_segment); in gst_single_queue_push_one()
2065 apply_gap (mq, sq, event, &sq->src_segment); in gst_single_queue_push_one()
2074 GST_DEBUG_OBJECT (mq, in gst_single_queue_push_one()
2079 GST_DEBUG_OBJECT (mq, in gst_single_queue_push_one()
2092 GST_DEBUG_OBJECT (mq, in gst_single_queue_push_one()
2100 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_single_queue_push_one()
2104 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_single_queue_push_one()
2182 GstMultiQueue *mq; in gst_multi_queue_loop() local
2194 mq = g_weak_ref_get (&sq->mqueue); in gst_multi_queue_loop()
2197 if (!mq || !srcpad) in gst_multi_queue_loop()
2201 GST_DEBUG_OBJECT (mq, "SingleQueue %d : trying to pop an object", sq->id); in gst_multi_queue_loop()
2225 GST_LOG_OBJECT (mq, "SingleQueue %d : newid:%d , oldid:%d", in gst_multi_queue_loop()
2233 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_loop()
2236 || sq->last_oldid > mq->highid) { in gst_multi_queue_loop()
2237 GST_LOG_OBJECT (mq, "CHECKING sq->srcresult: %s", in gst_multi_queue_loop()
2243 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2251 next_time += mq->unlinked_cache_time; in gst_multi_queue_loop()
2263 compute_high_id (mq); in gst_multi_queue_loop()
2265 compute_high_time (mq, sq->groupid); in gst_multi_queue_loop()
2267 GST_DEBUG_OBJECT (mq, in gst_multi_queue_loop()
2272 if (mq->sync_by_running_time) { in gst_multi_queue_loop()
2275 (mq->high_time == GST_CLOCK_STIME_NONE in gst_multi_queue_loop()
2276 || next_time > mq->high_time); in gst_multi_queue_loop()
2282 should_wait = newid > mq->highid; in gst_multi_queue_loop()
2286 GST_DEBUG_OBJECT (mq, in gst_multi_queue_loop()
2289 ", high_time %" GST_STIME_FORMAT, sq->id, newid, mq->highid, in gst_multi_queue_loop()
2293 wake_up_next_non_linked (mq); in gst_multi_queue_loop()
2295 mq->numwaiting++; in gst_multi_queue_loop()
2296 g_cond_wait (&sq->turn, &mq->qlock); in gst_multi_queue_loop()
2297 mq->numwaiting--; in gst_multi_queue_loop()
2300 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2305 compute_high_time (mq, sq->groupid); in gst_multi_queue_loop()
2306 compute_high_id (mq); in gst_multi_queue_loop()
2308 GST_DEBUG_OBJECT (mq, "queue %d woken from sleeping for not-linked " in gst_multi_queue_loop()
2311 sq->id, newid, mq->highid, in gst_multi_queue_loop()
2313 GST_STIME_ARGS (mq->high_time)); in gst_multi_queue_loop()
2315 if (mq->sync_by_running_time) { in gst_multi_queue_loop()
2318 (mq->high_time == GST_CLOCK_STIME_NONE in gst_multi_queue_loop()
2319 || next_time > mq->high_time); in gst_multi_queue_loop()
2325 should_wait = newid > mq->highid; in gst_multi_queue_loop()
2329 compute_high_id (mq); in gst_multi_queue_loop()
2330 compute_high_time (mq, sq->groupid); in gst_multi_queue_loop()
2332 compute_high_id (mq); in gst_multi_queue_loop()
2333 compute_high_time (mq, sq->groupid); in gst_multi_queue_loop()
2335 wake_up_next_non_linked (mq); in gst_multi_queue_loop()
2341 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2346 GST_LOG_OBJECT (mq, "sq:%d BEFORE PUSHING sq->srcresult: %s", sq->id, in gst_multi_queue_loop()
2350 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_loop()
2355 if (mq->high_time == GST_CLOCK_STIME_NONE || mq->high_time <= next_time) { in gst_multi_queue_loop()
2357 mq->high_time = next_time; in gst_multi_queue_loop()
2358 wake_up_next_non_linked (mq); in gst_multi_queue_loop()
2361 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2364 result = gst_single_queue_push_one (mq, sq, object, &dropping); in gst_multi_queue_loop()
2375 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_loop()
2380 GST_LOG_OBJECT (mq, "SingleQueue %d : Changed from active to non-active", in gst_multi_queue_loop()
2383 compute_high_id (mq); in gst_multi_queue_loop()
2384 compute_high_time (mq, sq->groupid); in gst_multi_queue_loop()
2388 if (mq->numwaiting > 0) { in gst_multi_queue_loop()
2390 for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { in gst_multi_queue_loop()
2394 GST_LOG_OBJECT (mq, "Waking up singlequeue %d", sq2->id); in gst_multi_queue_loop()
2412 GST_DEBUG_OBJECT (mq, "starting EOS drop on sq %d", sq->id); in gst_multi_queue_loop()
2420 GST_DEBUG_OBJECT (mq, "committed EOS drop on sq %d", sq->id); in gst_multi_queue_loop()
2428 update_buffering (mq, sq); in gst_multi_queue_loop()
2430 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2431 gst_multi_queue_post_buffering (mq); in gst_multi_queue_loop()
2433 GST_LOG_OBJECT (mq, "sq:%d AFTER PUSHING sq->srcresult: %s (is_eos:%d)", in gst_multi_queue_loop()
2437 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_loop()
2438 if (mq->numwaiting > 0 && (GST_PAD_IS_EOS (srcpad) in gst_multi_queue_loop()
2440 compute_high_time (mq, sq->groupid); in gst_multi_queue_loop()
2441 compute_high_id (mq); in gst_multi_queue_loop()
2442 wake_up_next_non_linked (mq); in gst_multi_queue_loop()
2444 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2454 gst_clear_object (&mq); in gst_multi_queue_loop()
2464 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_loop()
2473 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2474 GST_ELEMENT_FLOW_ERROR (mq, sq->srcresult); in gst_multi_queue_loop()
2476 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_loop()
2488 GST_CAT_LOG_OBJECT (multi_queue_debug, mq, in gst_multi_queue_loop()
2506 GstMultiQueue *mq; in gst_multi_queue_chain() local
2512 mq = g_weak_ref_get (&sq->mqueue); in gst_multi_queue_chain()
2514 if (!mq) in gst_multi_queue_chain()
2524 curid = g_atomic_int_add ((gint *) & mq->counter, 1); in gst_multi_queue_chain()
2529 GST_LOG_OBJECT (mq, in gst_multi_queue_chain()
2538 if (mq->use_interleave) { in gst_multi_queue_chain()
2542 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_chain()
2551 GST_DEBUG_OBJECT (mq, in gst_multi_queue_chain()
2555 calculate_interleave (mq, sq); in gst_multi_queue_chain()
2557 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_chain()
2565 apply_buffer (mq, sq, timestamp, duration, &sq->sink_segment); in gst_multi_queue_chain()
2568 gst_clear_object (&mq); in gst_multi_queue_chain()
2574 GST_LOG_OBJECT (mq, "SingleQueue %d : exit because task paused, reason: %s", in gst_multi_queue_chain()
2582 GST_DEBUG_OBJECT (mq, "we are EOS, dropping buffer, return EOS"); in gst_multi_queue_chain()
2584 gst_object_unref (mq); in gst_multi_queue_chain()
2595 GstMultiQueue *mq; in gst_multi_queue_sink_activate_mode() local
2598 mq = (GstMultiQueue *) gst_pad_get_parent (pad); in gst_multi_queue_sink_activate_mode()
2602 if (mq) in gst_multi_queue_sink_activate_mode()
2603 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_activate_mode()
2619 if (mq) in gst_multi_queue_sink_activate_mode()
2620 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_activate_mode()
2622 if (mq) in gst_multi_queue_sink_activate_mode()
2623 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_activate_mode()
2625 if (mq) in gst_multi_queue_sink_activate_mode()
2626 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_activate_mode()
2628 if (mq) in gst_multi_queue_sink_activate_mode()
2629 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_activate_mode()
2638 if (mq) { in gst_multi_queue_sink_activate_mode()
2639 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_activate_mode()
2640 gst_object_unref (mq); in gst_multi_queue_sink_activate_mode()
2650 GstMultiQueue *mq; in gst_multi_queue_sink_event() local
2661 mq = (GstMultiQueue *) parent; in gst_multi_queue_sink_event()
2676 if (mq->sync_by_running_time) { in gst_multi_queue_sink_event()
2680 GST_INFO_OBJECT (mq, "SingleQueue %d is a sparse stream", sq->id); in gst_multi_queue_sink_event()
2692 GST_DEBUG_OBJECT (mq, "SingleQueue %d : received flush start event", in gst_multi_queue_sink_event()
2697 gst_single_queue_flush (mq, sq, TRUE, FALSE); in gst_multi_queue_sink_event()
2698 gst_single_queue_pause (mq, sq); in gst_multi_queue_sink_event()
2702 GST_DEBUG_OBJECT (mq, "SingleQueue %d : received flush stop event", in gst_multi_queue_sink_event()
2707 gst_single_queue_flush (mq, sq, FALSE, FALSE); in gst_multi_queue_sink_event()
2708 gst_single_queue_start (mq, sq); in gst_multi_queue_sink_event()
2719 if (mq->use_interleave) { in gst_multi_queue_sink_event()
2724 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_event()
2730 calculate_interleave (mq, sq); in gst_multi_queue_sink_event()
2732 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_event()
2750 curid = g_atomic_int_add ((gint *) & mq->counter, 1); in gst_multi_queue_sink_event()
2754 GST_DEBUG_OBJECT (mq, in gst_multi_queue_sink_event()
2766 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_event()
2767 update_buffering (mq, sq); in gst_multi_queue_sink_event()
2768 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_event()
2770 gst_multi_queue_post_buffering (mq); in gst_multi_queue_sink_event()
2773 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_event()
2781 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_event()
2782 GST_ELEMENT_FLOW_ERROR (mq, sq->srcresult); in gst_multi_queue_sink_event()
2784 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_event()
2788 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_event()
2789 update_buffering (mq, sq); in gst_multi_queue_sink_event()
2790 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_event()
2792 gst_multi_queue_post_buffering (mq); in gst_multi_queue_sink_event()
2795 apply_segment (mq, sq, sref, &sq->sink_segment); in gst_multi_queue_sink_event()
2799 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_event()
2802 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_event()
2806 apply_gap (mq, sq, sref, &sq->sink_segment); in gst_multi_queue_sink_event()
2817 GST_DEBUG_OBJECT (mq, "SingleQueue %d : returning %s", sq->id, in gst_multi_queue_sink_event()
2824 GST_LOG_OBJECT (mq, "SingleQueue %d : exit because task paused, reason: %s", in gst_multi_queue_sink_event()
2834 GST_DEBUG_OBJECT (mq, "we are EOS, dropping event, return GST_FLOW_EOS"); in gst_multi_queue_sink_event()
2845 GstMultiQueue *mq; in gst_multi_queue_sink_query() local
2848 mq = (GstMultiQueue *) parent; in gst_multi_queue_sink_query()
2856 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_query()
2867 if (!mq->use_buffering || gst_data_queue_is_empty (sq->queue)) { in gst_multi_queue_sink_query()
2869 curid = g_atomic_int_add ((gint *) & mq->counter, 1); in gst_multi_queue_sink_query()
2873 GST_DEBUG_OBJECT (mq, in gst_multi_queue_sink_query()
2876 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_query()
2878 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_sink_query()
2889 g_cond_wait (&sq->query_handled, &mq->qlock); in gst_multi_queue_sink_query()
2893 GST_DEBUG_OBJECT (mq, "refusing query, we are buffering and the " in gst_multi_queue_sink_query()
2897 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_query()
2908 GST_DEBUG_OBJECT (mq, "Flushing"); in gst_multi_queue_sink_query()
2909 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_sink_query()
2918 GstMultiQueue *mq; in gst_multi_queue_src_activate_mode() local
2923 mq = g_weak_ref_get (&sq->mqueue); in gst_multi_queue_src_activate_mode()
2925 if (!mq) { in gst_multi_queue_src_activate_mode()
2931 GST_DEBUG_OBJECT (mq, "SingleQueue %d", sq->id); in gst_multi_queue_src_activate_mode()
2936 gst_single_queue_flush (mq, sq, FALSE, TRUE); in gst_multi_queue_src_activate_mode()
2937 result = parent ? gst_single_queue_start (mq, sq) : TRUE; in gst_multi_queue_src_activate_mode()
2939 gst_single_queue_flush (mq, sq, TRUE, TRUE); in gst_multi_queue_src_activate_mode()
2940 result = gst_single_queue_stop (mq, sq); in gst_multi_queue_src_activate_mode()
2947 gst_object_unref (mq); in gst_multi_queue_src_activate_mode()
2955 GstMultiQueue *mq = g_weak_ref_get (&sq->mqueue); in gst_multi_queue_src_event() local
2959 if (!mq || !sinkpad) { in gst_multi_queue_src_event()
2961 gst_clear_object (&mq); in gst_multi_queue_src_event()
2969 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_multi_queue_src_event()
2974 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_multi_queue_src_event()
2984 gst_object_unref (mq); in gst_multi_queue_src_event()
3010 wake_up_next_non_linked (GstMultiQueue * mq) in wake_up_next_non_linked() argument
3015 if (mq->numwaiting < 1) in wake_up_next_non_linked()
3018 if (mq->sync_by_running_time && GST_CLOCK_STIME_IS_VALID (mq->high_time)) { in wake_up_next_non_linked()
3020 for (tmp = mq->queues; tmp; tmp = tmp->next) { in wake_up_next_non_linked()
3028 high_time = mq->high_time; in wake_up_next_non_linked()
3033 GST_LOG_OBJECT (mq, "Waking up singlequeue %d", sq->id); in wake_up_next_non_linked()
3040 for (tmp = mq->queues; tmp; tmp = tmp->next) { in wake_up_next_non_linked()
3043 sq->nextid != 0 && sq->nextid <= mq->highid) { in wake_up_next_non_linked()
3044 GST_LOG_OBJECT (mq, "Waking up singlequeue %d", sq->id); in wake_up_next_non_linked()
3053 compute_high_id (GstMultiQueue * mq) in compute_high_id() argument
3061 for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { in compute_high_id()
3066 GST_INFO_OBJECT (mq, in compute_high_id()
3072 GST_LOG_OBJECT (mq, "inspecting sq:%d , nextid:%d, oldid:%d, srcresult:%s", in compute_high_id()
3077 GST_LOG_OBJECT (mq, "sq:%d is not waiting - ignoring", sq->id); in compute_high_id()
3096 mq->highid = lowest; in compute_high_id()
3098 mq->highid = highid; in compute_high_id()
3100 GST_LOG_OBJECT (mq, "Highid is now : %u, lowest non-linked %u", mq->highid, in compute_high_id()
3106 compute_high_time (GstMultiQueue * mq, guint groupid) in compute_high_time() argument
3120 if (!mq->sync_by_running_time) in compute_high_time()
3124 for (tmp = mq->queues; tmp; tmp = tmp->next) { in compute_high_time()
3129 GST_INFO_OBJECT (mq, in compute_high_time()
3135 GST_LOG_OBJECT (mq, in compute_high_time()
3147 GST_LOG_OBJECT (mq, "sq:%d is not waiting - ignoring", sq->id); in compute_high_time()
3169 GST_LOG_OBJECT (mq, in compute_high_time()
3173 GST_LOG_OBJECT (mq, in compute_high_time()
3181 mq->high_time = lowest; in compute_high_time()
3183 mq->high_time = highest; in compute_high_time()
3193 GST_LOG_OBJECT (mq, "group count %d for groupid %u", group_count, groupid); in compute_high_time()
3194 GST_LOG_OBJECT (mq, in compute_high_time()
3197 GST_STIME_ARGS (mq->high_time), groupid, GST_STIME_ARGS (mq->high_time), in compute_high_time()
3200 for (tmp = mq->queues; tmp; tmp = tmp->next) { in compute_high_time()
3220 GstMultiQueue *mq = g_weak_ref_get (&sq->mqueue); in single_queue_overrun_cb() local
3222 if (!mq) { in single_queue_overrun_cb()
3230 GST_LOG_OBJECT (mq, in single_queue_overrun_cb()
3236 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in single_queue_overrun_cb()
3246 for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { in single_queue_overrun_cb()
3253 GST_LOG_OBJECT (mq, "Queue %d is not-linked", oq->id); in single_queue_overrun_cb()
3257 GST_LOG_OBJECT (mq, "Checking Queue %d", oq->id); in single_queue_overrun_cb()
3259 GST_LOG_OBJECT (mq, "Queue %d is empty", oq->id); in single_queue_overrun_cb()
3270 GST_DEBUG_OBJECT (mq, in single_queue_overrun_cb()
3278 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in single_queue_overrun_cb()
3279 gst_object_unref (mq); in single_queue_overrun_cb()
3283 GST_DEBUG_OBJECT (mq, "Queue %d is filled, signalling overrun", sq->id); in single_queue_overrun_cb()
3284 g_signal_emit (mq, gst_multi_queue_signals[SIGNAL_OVERRUN], 0); in single_queue_overrun_cb()
3292 GstMultiQueue *mq = g_weak_ref_get (&sq->mqueue); in single_queue_underrun_cb() local
3295 if (!mq) { in single_queue_underrun_cb()
3302 GST_LOG_OBJECT (mq, "Single Queue %d is empty but not-linked", sq->id); in single_queue_underrun_cb()
3303 gst_object_unref (mq); in single_queue_underrun_cb()
3306 GST_LOG_OBJECT (mq, in single_queue_underrun_cb()
3310 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in single_queue_underrun_cb()
3311 for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { in single_queue_underrun_cb()
3320 GST_DEBUG_OBJECT (mq, in single_queue_underrun_cb()
3329 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in single_queue_underrun_cb()
3330 gst_object_unref (mq); in single_queue_underrun_cb()
3333 GST_DEBUG_OBJECT (mq, "All queues are empty, signalling it"); in single_queue_underrun_cb()
3334 g_signal_emit (mq, gst_multi_queue_signals[SIGNAL_UNDERRUN], 0); in single_queue_underrun_cb()
3343 GstMultiQueue *mq = g_weak_ref_get (&sq->mqueue); in single_queue_check_full() local
3345 if (!mq) { in single_queue_check_full()
3351 GST_DEBUG_OBJECT (mq, in single_queue_check_full()
3363 if (!mq->use_buffering && IS_FILLED (sq, visible, visible)) { in single_queue_check_full()
3372 if (!sq->is_sparse || !mq->sync_by_running_time) { in single_queue_check_full()
3374 if (mq->sync_by_running_time && sq->srcresult == GST_FLOW_NOT_LINKED) { in single_queue_check_full()
3375 if (sq->cur_time > mq->unlinked_cache_time) in single_queue_check_full()
3376 res |= IS_FILLED (sq, time, sq->cur_time - mq->unlinked_cache_time); in single_queue_check_full()
3383 gst_object_unref (mq); in single_queue_check_full()
3395 GstMultiQueue *mq = g_weak_ref_get (&sq->mqueue); in gst_single_queue_flush_queue() local
3429 if (mq) { in gst_single_queue_flush_queue()
3430 GST_MULTI_QUEUE_MUTEX_LOCK (mq); in gst_single_queue_flush_queue()
3431 update_buffering (mq, sq); in gst_single_queue_flush_queue()
3432 GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); in gst_single_queue_flush_queue()
3433 gst_multi_queue_post_buffering (mq); in gst_single_queue_flush_queue()
3434 gst_object_unref (mq); in gst_single_queue_flush_queue()