gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2003 Colin Walters <cwalters@gnome.org>
|
gst/playback/: Add playbin2.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstplayback.c: (plugin_init):
* gst/playback/test7.c: (update_scale), (warning_cb), (error_cb),
(eos_cb), (about_to_finish_cb), (main):
Add playbin2.
Added gapless playback example.
* gst/playback/gstplaybasebin.c:
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gst_play_bin_plugin_init):
* gst/playback/gstqueue2.c:
* gst/playback/test.c:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init),
(pad_removed_cb):
* gst/playback/gststreaminfo.h:
Change email.
* gst/playback/gstplaybin2.c: (gst_play_bin_get_type),
(gst_play_bin_class_init), (init_group), (gst_play_bin_init),
(gst_play_bin_dispose), (gst_play_bin_set_uri),
(gst_play_bin_set_suburi), (gst_play_bin_set_property),
(gst_play_bin_get_property), (gst_play_bin_handle_message),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb), (perform_eos),
(drained_cb), (unlink_group), (activate_group),
(setup_next_source), (gst_play_bin_change_state),
(gst_play_bin2_plugin_init):
Added raw first version of playbin2. Does chained oggs and gapless
playback fine. No support for raw sinks yet. No visualisations or
subtitles yet.
* gst/playback/gstplaysink.c: (gst_play_sink_get_type),
(gst_play_sink_class_init), (gst_play_sink_init),
(gst_play_sink_dispose), (gst_play_sink_vis_unblocked),
(gst_play_sink_vis_blocked), (gst_play_sink_set_video_sink),
(gst_play_sink_set_audio_sink), (gst_play_sink_set_vis_plugin),
(gst_play_sink_set_property), (gst_play_sink_get_property),
(post_missing_element_message), (free_chain), (add_chain),
(activate_chain), (gen_video_chain), (gen_text_element),
(gen_audio_chain), (gen_vis_element), (gst_play_sink_get_mode),
(gst_play_sink_set_mode), (gst_play_sink_request_pad),
(gst_play_sink_release_pad), (gst_play_sink_send_event_to_sink),
(gst_play_sink_send_event), (gst_play_sink_change_state):
* gst/playback/gstplaysink.h:
Added Element that abstracts the sinks and their pipelines for playbin2.
2007-11-16 15:44:48 +00:00
|
|
|
* 2000,2005,2007 Wim Taymans <wim.taymans@gmail.com>
|
2007-06-06 13:36:26 +00:00
|
|
|
* 2007 Thiago Sousa Santos <thiagoss@lcc.ufcg.edu.br>
|
2010-06-15 06:59:11 +00:00
|
|
|
* SA 2010 ST-Ericsson <benjamin.gaignard@stericsson.com>
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
|
|
|
* gstqueue2.c:
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-queue2
|
2017-01-16 14:26:16 +00:00
|
|
|
* @title: queue2
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
|
|
|
* Data is queued until one of the limits specified by the
|
2010-01-20 01:33:38 +00:00
|
|
|
* #GstQueue2:max-size-buffers, #GstQueue2:max-size-bytes and/or
|
|
|
|
* #GstQueue2:max-size-time properties has been reached. Any attempt to push
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
* more buffers into the queue will block the pushing thread until more space
|
|
|
|
* becomes available.
|
|
|
|
*
|
|
|
|
* The queue will create a new thread on the source pad to decouple the
|
|
|
|
* processing on sink and source pad.
|
|
|
|
*
|
|
|
|
* You can query how many buffers are queued by reading the
|
2010-01-20 01:33:38 +00:00
|
|
|
* #GstQueue2:current-level-buffers property.
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
|
|
|
* The default queue size limits are 100 buffers, 2MB of data, or
|
|
|
|
* two seconds worth of data, whichever is reached first.
|
2007-06-06 13:36:26 +00:00
|
|
|
*
|
2012-05-31 09:10:41 +00:00
|
|
|
* If you set temp-template to a value such as /tmp/gstreamer-XXXXXX, the element
|
2009-07-10 18:49:46 +00:00
|
|
|
* will allocate a random free filename and buffer data in the file.
|
|
|
|
* By using this, it will buffer the entire stream data on the file independently
|
|
|
|
* of the queue size limits, they will only be used for buffering statistics.
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
2012-07-06 09:07:56 +00:00
|
|
|
* The temp-location property will be used to notify the application of the
|
|
|
|
* allocated filename.
|
2019-10-04 14:57:29 +00:00
|
|
|
*
|
|
|
|
* If the #GstQueue2:use-buffering property is set to TRUE, and any writable
|
|
|
|
* property is modified, #GstQueue2 will attempt to post a buffering message
|
|
|
|
* if the changes to the properties also cause the buffering percentage to be
|
|
|
|
* changed (for example, because the queue's capacity was changed and it already
|
|
|
|
* contains some data).
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*/
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/gstqueue2.c: fix build.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_finalize), (update_time_level),
(apply_segment), (apply_buffer), (update_buffering),
(reset_rate_timer), (update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_filled),
(gst_queue_chain), (gst_queue_push_one), (gst_queue_loop),
(plugin_init):
fix build.
2007-05-17 13:36:11 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:21:36 +00:00
|
|
|
#include "gstqueue2.h"
|
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#include "gst/gst-i18n-lib.h"
|
2011-12-04 13:35:38 +00:00
|
|
|
#include "gst/glib-compat-private.h"
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2009-03-20 13:17:19 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
#include <io.h> /* lseek, open, close, read */
|
|
|
|
#undef lseek
|
|
|
|
#define lseek _lseeki64
|
|
|
|
#undef off_t
|
|
|
|
#define off_t guint64
|
2009-07-10 18:49:46 +00:00
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
2009-03-20 13:17:19 +00:00
|
|
|
#endif
|
|
|
|
|
2015-12-12 04:42:05 +00:00
|
|
|
#ifdef __BIONIC__ /* Android */
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (queue_debug);
|
|
|
|
#define GST_CAT_DEFAULT (queue_debug)
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
/* other defines */
|
|
|
|
#define DEFAULT_BUFFER_SIZE 4096
|
2012-07-06 09:07:56 +00:00
|
|
|
#define QUEUE_IS_USING_TEMP_FILE(queue) ((queue)->temp_template != NULL)
|
2010-10-31 17:23:00 +00:00
|
|
|
#define QUEUE_IS_USING_RING_BUFFER(queue) ((queue)->ring_buffer_max_size != 0) /* for consistency with the above macro */
|
2010-06-15 14:12:02 +00:00
|
|
|
#define QUEUE_IS_USING_QUEUE(queue) (!QUEUE_IS_USING_TEMP_FILE(queue) && !QUEUE_IS_USING_RING_BUFFER (queue))
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-16 15:03:49 +00:00
|
|
|
#define QUEUE_MAX_BYTES(queue) MIN((queue)->max_level.bytes, (queue)->ring_buffer_max_size)
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* default property values */
|
|
|
|
#define DEFAULT_MAX_SIZE_BUFFERS 100 /* 100 buffers */
|
|
|
|
#define DEFAULT_MAX_SIZE_BYTES (2 * 1024 * 1024) /* 2 MB */
|
|
|
|
#define DEFAULT_MAX_SIZE_TIME 2 * GST_SECOND /* 2 seconds */
|
|
|
|
#define DEFAULT_USE_BUFFERING FALSE
|
2015-11-11 14:14:34 +00:00
|
|
|
#define DEFAULT_USE_TAGS_BITRATE FALSE
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
#define DEFAULT_USE_RATE_ESTIMATE TRUE
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
#define DEFAULT_LOW_PERCENT 10
|
|
|
|
#define DEFAULT_HIGH_PERCENT 99
|
2016-08-03 13:20:20 +00:00
|
|
|
#define DEFAULT_LOW_WATERMARK 0.01
|
|
|
|
#define DEFAULT_HIGH_WATERMARK 0.99
|
2010-01-22 16:55:39 +00:00
|
|
|
#define DEFAULT_TEMP_REMOVE TRUE
|
2010-06-16 10:24:25 +00:00
|
|
|
#define DEFAULT_RING_BUFFER_MAX_SIZE 0
|
2018-05-17 11:42:43 +00:00
|
|
|
#define DEFAULT_USE_BITRATE_QUERY TRUE
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CUR_LEVEL_BUFFERS,
|
|
|
|
PROP_CUR_LEVEL_BYTES,
|
|
|
|
PROP_CUR_LEVEL_TIME,
|
|
|
|
PROP_MAX_SIZE_BUFFERS,
|
|
|
|
PROP_MAX_SIZE_BYTES,
|
|
|
|
PROP_MAX_SIZE_TIME,
|
|
|
|
PROP_USE_BUFFERING,
|
2015-11-11 14:14:34 +00:00
|
|
|
PROP_USE_TAGS_BITRATE,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
PROP_USE_RATE_ESTIMATE,
|
|
|
|
PROP_LOW_PERCENT,
|
|
|
|
PROP_HIGH_PERCENT,
|
2016-08-03 13:20:20 +00:00
|
|
|
PROP_LOW_WATERMARK,
|
|
|
|
PROP_HIGH_WATERMARK,
|
2009-07-10 18:49:46 +00:00
|
|
|
PROP_TEMP_TEMPLATE,
|
2010-01-22 16:55:39 +00:00
|
|
|
PROP_TEMP_LOCATION,
|
|
|
|
PROP_TEMP_REMOVE,
|
2010-05-05 08:21:55 +00:00
|
|
|
PROP_RING_BUFFER_MAX_SIZE,
|
2015-02-23 03:16:19 +00:00
|
|
|
PROP_AVG_IN_RATE,
|
2018-05-17 11:42:43 +00:00
|
|
|
PROP_USE_BITRATE_QUERY,
|
|
|
|
PROP_BITRATE,
|
2010-01-22 16:55:39 +00:00
|
|
|
PROP_LAST
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
};
|
2019-10-31 10:06:48 +00:00
|
|
|
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
/* Explanation for buffer levels and percentages:
|
|
|
|
*
|
|
|
|
* The buffering_level functions here return a value in a normalized range
|
|
|
|
* that specifies the queue's current fill level. The range goes from 0 to
|
|
|
|
* MAX_BUFFERING_LEVEL. The low/high watermarks also use this same range.
|
|
|
|
*
|
|
|
|
* This is not to be confused with the buffering_percent value, which is
|
|
|
|
* a *relative* quantity - relative to the low/high watermarks.
|
|
|
|
* buffering_percent = 0% means buffering_level is at the low watermark.
|
|
|
|
* buffering_percent = 100% means buffering_level is at the high watermark.
|
|
|
|
* buffering_percent is used for determining if the fill level has reached
|
|
|
|
* the high watermark, and for producing BUFFERING messages. This value
|
|
|
|
* always uses a 0..100 range (since it is a percentage).
|
|
|
|
*
|
|
|
|
* To avoid future confusions, whenever "buffering level" is mentioned, it
|
|
|
|
* refers to the absolute level which is in the 0..MAX_BUFFERING_LEVEL
|
|
|
|
* range. Whenever "buffering_percent" is mentioned, it refers to the
|
|
|
|
* percentage value that is relative to the low/high watermark. */
|
|
|
|
|
2016-08-03 13:20:20 +00:00
|
|
|
/* Using a buffering level range of 0..1000000 to allow for a
|
|
|
|
* resolution in ppm (1 ppm = 0.0001%) */
|
|
|
|
#define MAX_BUFFERING_LEVEL 1000000
|
|
|
|
|
|
|
|
/* How much 1% makes up in the buffer level range */
|
|
|
|
#define BUF_LEVEL_PERCENT_FACTOR ((MAX_BUFFERING_LEVEL) / 100)
|
2016-08-03 13:27:40 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_CLEAR_LEVEL(l) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
l.buffers = 0; \
|
|
|
|
l.bytes = 0; \
|
|
|
|
l.time = 0; \
|
|
|
|
l.rate_time = 0; \
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
#define STATUS(queue, pad, msg) \
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, \
|
|
|
|
"(%s:%s) " msg ": %u of %u buffers, %u of %u " \
|
|
|
|
"bytes, %" G_GUINT64_FORMAT " of %" G_GUINT64_FORMAT \
|
2007-06-07 09:11:27 +00:00
|
|
|
" ns, %"G_GUINT64_FORMAT" items", \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_DEBUG_PAD_NAME (pad), \
|
|
|
|
queue->cur_level.buffers, \
|
|
|
|
queue->max_level.buffers, \
|
|
|
|
queue->cur_level.bytes, \
|
|
|
|
queue->max_level.bytes, \
|
|
|
|
queue->cur_level.time, \
|
|
|
|
queue->max_level.time, \
|
2010-06-15 14:12:02 +00:00
|
|
|
(guint64) (!QUEUE_IS_USING_QUEUE(queue) ? \
|
2010-03-23 18:25:29 +00:00
|
|
|
queue->current->writing_pos - queue->current->max_reading_pos : \
|
2018-06-02 12:02:19 +00:00
|
|
|
gst_queue_array_get_length(queue->queue)))
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_MUTEX_LOCK(q) G_STMT_START { \
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&q->qlock); \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
#define GST_QUEUE2_MUTEX_LOCK_CHECK(q,res,label) G_STMT_START { \
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (q); \
|
|
|
|
if (res != GST_FLOW_OK) \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
goto label; \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_MUTEX_UNLOCK(q) G_STMT_START { \
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&q->qlock); \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
#define GST_QUEUE2_WAIT_DEL_CHECK(q, res, label) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->sinkpad, "wait for DEL"); \
|
|
|
|
q->waiting_del = TRUE; \
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_wait (&q->item_del, &queue->qlock); \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
q->waiting_del = FALSE; \
|
2010-03-24 17:18:13 +00:00
|
|
|
if (res != GST_FLOW_OK) { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->srcpad, "received DEL wakeup"); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
STATUS (queue, q->sinkpad, "received DEL"); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
#define GST_QUEUE2_WAIT_ADD_CHECK(q, res, label) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->srcpad, "wait for ADD"); \
|
|
|
|
q->waiting_add = TRUE; \
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_wait (&q->item_add, &q->qlock); \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
q->waiting_add = FALSE; \
|
2010-03-24 17:18:13 +00:00
|
|
|
if (res != GST_FLOW_OK) { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->srcpad, "received ADD wakeup"); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
STATUS (queue, q->srcpad, "received ADD"); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_SIGNAL_DEL(q) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (q->waiting_del) { \
|
|
|
|
STATUS (q, q->srcpad, "signal DEL"); \
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_signal (&q->item_del); \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_SIGNAL_ADD(q) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (q->waiting_add) { \
|
|
|
|
STATUS (q, q->sinkpad, "signal ADD"); \
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_signal (&q->item_add); \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2014-09-19 15:02:46 +00:00
|
|
|
#define SET_PERCENT(q, perc) G_STMT_START { \
|
|
|
|
if (perc != q->buffering_percent) { \
|
|
|
|
q->buffering_percent = perc; \
|
|
|
|
q->percent_changed = TRUE; \
|
|
|
|
GST_DEBUG_OBJECT (q, "buffering %d percent", perc); \
|
|
|
|
get_buffering_stats (q, perc, &q->mode, &q->avg_in, &q->avg_out, \
|
|
|
|
&q->buffering_left); \
|
|
|
|
} \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2011-04-18 16:07:06 +00:00
|
|
|
#define _do_init \
|
2009-10-29 10:35:08 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (queue_debug, "queue2", 0, "queue element"); \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue2_dataflow", 0, \
|
|
|
|
"dataflow inside the queue element");
|
2011-04-18 16:07:06 +00:00
|
|
|
#define gst_queue2_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstQueue2, gst_queue2, GST_TYPE_ELEMENT, _do_init);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static void gst_queue2_finalize (GObject * object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static void gst_queue2_set_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2009-10-29 10:30:11 +00:00
|
|
|
static void gst_queue2_get_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
static GstFlowReturn gst_queue2_chain (GstPad * pad, GstObject * parent,
|
|
|
|
GstBuffer * buffer);
|
2011-11-28 00:40:55 +00:00
|
|
|
static GstFlowReturn gst_queue2_chain_list (GstPad * pad, GstObject * parent,
|
2011-11-03 10:34:49 +00:00
|
|
|
GstBufferList * buffer_list);
|
2009-10-29 10:30:11 +00:00
|
|
|
static GstFlowReturn gst_queue2_push_one (GstQueue2 * queue);
|
|
|
|
static void gst_queue2_loop (GstPad * pad);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2016-10-08 11:54:42 +00:00
|
|
|
static GstFlowReturn gst_queue2_handle_sink_event (GstPad * pad,
|
|
|
|
GstObject * parent, GstEvent * event);
|
2011-11-16 16:22:56 +00:00
|
|
|
static gboolean gst_queue2_handle_sink_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
static gboolean gst_queue2_handle_src_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2011-11-16 16:22:56 +00:00
|
|
|
static gboolean gst_queue2_handle_src_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query);
|
2010-03-25 17:13:02 +00:00
|
|
|
static gboolean gst_queue2_handle_query (GstElement * element,
|
2011-05-17 09:20:05 +00:00
|
|
|
GstQuery * query);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
static GstFlowReturn gst_queue2_get_range (GstPad * pad, GstObject * parent,
|
|
|
|
guint64 offset, guint length, GstBuffer ** buffer);
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2011-11-21 12:29:05 +00:00
|
|
|
static gboolean gst_queue2_src_activate_mode (GstPad * pad, GstObject * parent,
|
|
|
|
GstPadMode mode, gboolean active);
|
|
|
|
static gboolean gst_queue2_sink_activate_mode (GstPad * pad, GstObject * parent,
|
|
|
|
GstPadMode mode, gboolean active);
|
2009-10-29 10:30:11 +00:00
|
|
|
static GstStateChangeReturn gst_queue2_change_state (GstElement * element,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstStateChange transition);
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static gboolean gst_queue2_is_empty (GstQueue2 * queue);
|
|
|
|
static gboolean gst_queue2_is_filled (GstQueue2 * queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-07-29 15:27:06 +00:00
|
|
|
static void update_cur_level (GstQueue2 * queue, GstQueue2Range * range);
|
2016-07-11 07:58:47 +00:00
|
|
|
static void update_in_rates (GstQueue2 * queue, gboolean force);
|
2020-06-04 09:21:45 +00:00
|
|
|
static GstMessage *gst_queue2_get_buffering_message (GstQueue2 * queue,
|
|
|
|
gint * percent);
|
2020-05-26 17:41:37 +00:00
|
|
|
static void update_buffering (GstQueue2 * queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
static void gst_queue2_post_buffering (GstQueue2 * queue);
|
2010-07-29 15:27:06 +00:00
|
|
|
|
2011-11-03 08:55:20 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_QUEUE2_ITEM_TYPE_UNKNOWN = 0,
|
|
|
|
GST_QUEUE2_ITEM_TYPE_BUFFER,
|
2011-11-03 10:34:49 +00:00
|
|
|
GST_QUEUE2_ITEM_TYPE_BUFFER_LIST,
|
2013-05-24 17:22:22 +00:00
|
|
|
GST_QUEUE2_ITEM_TYPE_EVENT,
|
|
|
|
GST_QUEUE2_ITEM_TYPE_QUERY
|
2011-11-03 08:55:20 +00:00
|
|
|
} GstQueue2ItemType;
|
2010-07-29 15:27:06 +00:00
|
|
|
|
2013-05-27 13:41:14 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstQueue2ItemType type;
|
|
|
|
GstMiniObject *item;
|
|
|
|
} GstQueue2Item;
|
|
|
|
|
2016-02-16 17:11:59 +00:00
|
|
|
/* static guint gst_queue2_signals[LAST_SIGNAL] = { 0 }; */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_class_init (GstQueue2Class * klass)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
gobject_class->set_property = gst_queue2_set_property;
|
|
|
|
gobject_class->get_property = gst_queue2_get_property;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* properties */
|
2019-10-31 10:06:48 +00:00
|
|
|
obj_props[PROP_CUR_LEVEL_BYTES] = g_param_spec_uint ("current-level-bytes",
|
|
|
|
"Current level (kB)", "Current amount of data in the queue (bytes)",
|
|
|
|
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_CUR_LEVEL_BUFFERS] =
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_param_spec_uint ("current-level-buffers", "Current level (buffers)",
|
2019-10-31 10:06:48 +00:00
|
|
|
"Current number of buffers in the queue",
|
|
|
|
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_CUR_LEVEL_TIME] = g_param_spec_uint64 ("current-level-time",
|
|
|
|
"Current level (ns)", "Current amount of data in the queue (in ns)",
|
|
|
|
0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
obj_props[PROP_MAX_SIZE_BYTES] = g_param_spec_uint ("max-size-bytes",
|
|
|
|
"Max. size (kB)", "Max. amount of data in the queue (bytes, 0=disable)",
|
|
|
|
0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_MAX_SIZE_BUFFERS] = g_param_spec_uint ("max-size-buffers",
|
|
|
|
"Max. size (buffers)", "Max. number of buffers in the queue (0=disable)",
|
|
|
|
0, G_MAXUINT, DEFAULT_MAX_SIZE_BUFFERS,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_MAX_SIZE_TIME] = g_param_spec_uint64 ("max-size-time",
|
|
|
|
"Max. size (ns)", "Max. amount of data in the queue (in ns, 0=disable)",
|
|
|
|
0, G_MAXUINT64, DEFAULT_MAX_SIZE_TIME,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
obj_props[PROP_USE_BUFFERING] = g_param_spec_boolean ("use-buffering",
|
|
|
|
"Use buffering",
|
2020-04-06 15:14:12 +00:00
|
|
|
"Emit GST_MESSAGE_BUFFERING based on low-/high-percent thresholds "
|
|
|
|
"(0% = low-watermark, 100% = high-watermark)",
|
2019-10-31 10:06:48 +00:00
|
|
|
DEFAULT_USE_BUFFERING,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_USE_TAGS_BITRATE] = g_param_spec_boolean ("use-tags-bitrate",
|
|
|
|
"Use bitrate from tags",
|
|
|
|
"Use a bitrate from upstream tags to estimate buffer duration if not provided",
|
|
|
|
DEFAULT_USE_TAGS_BITRATE,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_USE_RATE_ESTIMATE] = g_param_spec_boolean ("use-rate-estimate",
|
|
|
|
"Use Rate Estimate",
|
|
|
|
"Estimate the bitrate of the stream to calculate time level",
|
|
|
|
DEFAULT_USE_RATE_ESTIMATE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_LOW_PERCENT] = g_param_spec_int ("low-percent", "Low percent",
|
|
|
|
"Low threshold for buffering to start. Only used if use-buffering is True "
|
|
|
|
"(Deprecated: use low-watermark instead)",
|
|
|
|
0, 100, DEFAULT_LOW_WATERMARK * 100,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_HIGH_PERCENT] = g_param_spec_int ("high-percent",
|
|
|
|
"High percent",
|
|
|
|
"High threshold for buffering to finish. Only used if use-buffering is True "
|
|
|
|
"(Deprecated: use high-watermark instead)",
|
|
|
|
0, 100, DEFAULT_HIGH_WATERMARK * 100,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_LOW_WATERMARK] = g_param_spec_double ("low-watermark",
|
|
|
|
"Low watermark",
|
|
|
|
"Low threshold for buffering to start. Only used if use-buffering is True",
|
|
|
|
0.0, 1.0, DEFAULT_LOW_WATERMARK,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
obj_props[PROP_HIGH_WATERMARK] = g_param_spec_double ("high-watermark",
|
|
|
|
"High watermark",
|
|
|
|
"High threshold for buffering to finish. Only used if use-buffering is True",
|
|
|
|
0.0, 1.0, DEFAULT_HIGH_WATERMARK,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
obj_props[PROP_TEMP_TEMPLATE] = g_param_spec_string ("temp-template",
|
|
|
|
"Temporary File Template",
|
|
|
|
"File template to store temporary files in, should contain directory "
|
|
|
|
"and XXXXXX. (NULL == disabled)",
|
|
|
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
obj_props[PROP_TEMP_LOCATION] = g_param_spec_string ("temp-location",
|
|
|
|
"Temporary File Location",
|
|
|
|
"Location to store temporary files in (Only read this property, "
|
|
|
|
"use temp-template to configure the name template)",
|
|
|
|
NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
obj_props[PROP_USE_BITRATE_QUERY] = g_param_spec_boolean ("use-bitrate-query",
|
|
|
|
"Use bitrate from downstream query",
|
|
|
|
"Use a bitrate from a downstream query to estimate buffer duration if not provided",
|
|
|
|
DEFAULT_USE_BITRATE_QUERY,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-01-22 17:00:53 +00:00
|
|
|
/**
|
|
|
|
* GstQueue2:temp-remove
|
|
|
|
*
|
|
|
|
* When temp-template is set, remove the temporary file when going to READY.
|
|
|
|
*/
|
2019-10-31 10:06:48 +00:00
|
|
|
obj_props[PROP_TEMP_REMOVE] = g_param_spec_boolean ("temp-remove",
|
|
|
|
"Remove the Temporary File", "Remove the temp-location after use",
|
|
|
|
DEFAULT_TEMP_REMOVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2010-01-22 16:55:39 +00:00
|
|
|
|
2010-05-05 08:21:55 +00:00
|
|
|
/**
|
|
|
|
* GstQueue2:ring-buffer-max-size
|
|
|
|
*
|
2010-06-16 10:24:25 +00:00
|
|
|
* The maximum size of the ring buffer in bytes. If set to 0, the ring
|
|
|
|
* buffer is disabled. Default 0.
|
2010-05-05 08:21:55 +00:00
|
|
|
*/
|
2019-10-31 10:06:48 +00:00
|
|
|
obj_props[PROP_RING_BUFFER_MAX_SIZE] =
|
2010-06-16 10:24:25 +00:00
|
|
|
g_param_spec_uint64 ("ring-buffer-max-size",
|
2019-10-31 10:06:48 +00:00
|
|
|
"Max. ring buffer size (bytes)",
|
|
|
|
"Max. amount of data in the ring buffer (bytes, 0 = disabled)",
|
|
|
|
0, G_MAXUINT64, DEFAULT_RING_BUFFER_MAX_SIZE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2010-05-05 08:21:55 +00:00
|
|
|
|
2015-02-23 03:16:19 +00:00
|
|
|
/**
|
|
|
|
* GstQueue2:avg-in-rate
|
|
|
|
*
|
|
|
|
* The average input data rate.
|
|
|
|
*/
|
2019-10-31 10:06:48 +00:00
|
|
|
obj_props[PROP_AVG_IN_RATE] = g_param_spec_int64 ("avg-in-rate",
|
|
|
|
"Input data rate (bytes/s)", "Average input data rate (bytes/s)",
|
|
|
|
0, G_MAXINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2015-02-23 03:16:19 +00:00
|
|
|
|
2018-05-17 11:42:43 +00:00
|
|
|
/**
|
|
|
|
* GstQueue2:bitrate
|
|
|
|
*
|
|
|
|
* The value used to convert between byte and time values for limiting
|
|
|
|
* the size of the queue. Values are taken from either the upstream tags
|
|
|
|
* or from the downstream bitrate query.
|
|
|
|
*/
|
2019-10-31 10:06:48 +00:00
|
|
|
obj_props[PROP_BITRATE] = g_param_spec_uint64 ("bitrate", "Bitrate (bits/s)",
|
|
|
|
"Conversion value between data size and time",
|
|
|
|
0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
2018-05-17 11:42:43 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* set several parent class virtual functions */
|
2009-10-29 10:30:11 +00:00
|
|
|
gobject_class->finalize = gst_queue2_finalize;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2016-02-27 15:36:28 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
|
2011-04-18 16:07:06 +00:00
|
|
|
|
2012-04-09 12:05:07 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Queue 2",
|
2011-04-18 16:07:06 +00:00
|
|
|
"Generic",
|
|
|
|
"Simple data queue",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
|
|
|
"Wim Taymans <wim.taymans@gmail.com>");
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue2_change_state);
|
2010-03-25 17:13:02 +00:00
|
|
|
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_queue2_handle_query);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-18 16:07:06 +00:00
|
|
|
gst_queue2_init (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
queue->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
|
|
|
|
|
|
|
gst_pad_set_chain_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_chain));
|
2011-11-03 10:34:49 +00:00
|
|
|
gst_pad_set_chain_list_function (queue->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_chain_list));
|
2011-11-21 12:29:05 +00:00
|
|
|
gst_pad_set_activatemode_function (queue->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_sink_activate_mode));
|
2016-10-08 11:54:42 +00:00
|
|
|
gst_pad_set_event_full_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_sink_event));
|
2011-11-09 16:36:00 +00:00
|
|
|
gst_pad_set_query_function (queue->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_sink_query));
|
2012-02-02 11:32:07 +00:00
|
|
|
GST_PAD_SET_PROXY_CAPS (queue->sinkpad);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
|
|
|
|
|
|
|
|
queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
|
|
|
|
|
2011-11-21 12:29:05 +00:00
|
|
|
gst_pad_set_activatemode_function (queue->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_mode));
|
2007-06-06 13:36:26 +00:00
|
|
|
gst_pad_set_getrange_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_get_range));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_event_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_src_event));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_query_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_src_query));
|
2012-02-02 11:32:07 +00:00
|
|
|
GST_PAD_SET_PROXY_CAPS (queue->srcpad);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
|
|
|
|
|
|
|
|
/* levels */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->max_level.buffers = DEFAULT_MAX_SIZE_BUFFERS;
|
|
|
|
queue->max_level.bytes = DEFAULT_MAX_SIZE_BYTES;
|
|
|
|
queue->max_level.time = DEFAULT_MAX_SIZE_TIME;
|
|
|
|
queue->max_level.rate_time = DEFAULT_MAX_SIZE_TIME;
|
|
|
|
queue->use_buffering = DEFAULT_USE_BUFFERING;
|
|
|
|
queue->use_rate_estimate = DEFAULT_USE_RATE_ESTIMATE;
|
2016-08-03 13:20:20 +00:00
|
|
|
queue->low_watermark = DEFAULT_LOW_WATERMARK * MAX_BUFFERING_LEVEL;
|
|
|
|
queue->high_watermark = DEFAULT_HIGH_WATERMARK * MAX_BUFFERING_LEVEL;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
gst_segment_init (&queue->sink_segment, GST_FORMAT_TIME);
|
|
|
|
gst_segment_init (&queue->src_segment, GST_FORMAT_TIME);
|
|
|
|
|
2010-10-19 15:40:13 +00:00
|
|
|
queue->sinktime = GST_CLOCK_TIME_NONE;
|
|
|
|
queue->srctime = GST_CLOCK_TIME_NONE;
|
|
|
|
queue->sink_tainted = TRUE;
|
|
|
|
queue->src_tainted = TRUE;
|
|
|
|
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->is_eos = FALSE;
|
2007-12-14 18:46:12 +00:00
|
|
|
queue->in_timer = g_timer_new ();
|
|
|
|
queue->out_timer = g_timer_new ();
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_init (&queue->qlock);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->waiting_add = FALSE;
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_init (&queue->item_add);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->waiting_del = FALSE;
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_init (&queue->item_del);
|
2018-06-02 12:02:19 +00:00
|
|
|
queue->queue = gst_queue_array_new_for_struct (sizeof (GstQueue2Item), 32);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2013-05-24 17:22:22 +00:00
|
|
|
g_cond_init (&queue->query_handled);
|
|
|
|
queue->last_query = FALSE;
|
|
|
|
|
2014-09-19 15:02:46 +00:00
|
|
|
g_mutex_init (&queue->buffering_post_lock);
|
2010-09-15 11:29:52 +00:00
|
|
|
queue->buffering_percent = 100;
|
2018-05-17 11:09:36 +00:00
|
|
|
queue->last_posted_buffering_percent = -1;
|
2010-09-15 11:29:52 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* tempfile related */
|
2009-07-10 18:49:46 +00:00
|
|
|
queue->temp_template = NULL;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
queue->temp_location = NULL;
|
2010-01-22 16:55:39 +00:00
|
|
|
queue->temp_remove = DEFAULT_TEMP_REMOVE;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
queue->ring_buffer = NULL;
|
2010-05-07 07:30:44 +00:00
|
|
|
queue->ring_buffer_max_size = DEFAULT_RING_BUFFER_MAX_SIZE;
|
2010-06-16 10:24:25 +00:00
|
|
|
|
2018-05-17 11:42:43 +00:00
|
|
|
queue->use_bitrate_query = DEFAULT_USE_BITRATE_QUERY;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"initialized queue's not_empty & not_full conditions");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called only once, as opposed to dispose */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_finalize (GObject * object)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (object);
|
2018-06-02 12:02:19 +00:00
|
|
|
GstQueue2Item *qitem;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "finalizing queue");
|
|
|
|
|
2018-06-02 12:02:19 +00:00
|
|
|
while ((qitem = gst_queue_array_pop_head_struct (queue->queue))) {
|
2013-05-27 13:41:14 +00:00
|
|
|
if (qitem->type != GST_QUEUE2_ITEM_TYPE_QUERY)
|
|
|
|
gst_mini_object_unref (qitem->item);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2018-06-02 12:02:19 +00:00
|
|
|
gst_queue_array_free (queue->queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2013-05-24 17:22:22 +00:00
|
|
|
queue->last_query = FALSE;
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_clear (&queue->qlock);
|
2014-09-19 15:02:46 +00:00
|
|
|
g_mutex_clear (&queue->buffering_post_lock);
|
2012-01-19 08:27:04 +00:00
|
|
|
g_cond_clear (&queue->item_add);
|
|
|
|
g_cond_clear (&queue->item_del);
|
2013-05-24 17:22:22 +00:00
|
|
|
g_cond_clear (&queue->query_handled);
|
2007-12-14 18:46:12 +00:00
|
|
|
g_timer_destroy (queue->in_timer);
|
|
|
|
g_timer_destroy (queue->out_timer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* temp_file path cleanup */
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (queue->temp_template);
|
|
|
|
g_free (queue->temp_location);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
static void
|
|
|
|
debug_ranges (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GstQueue2Range *walk;
|
|
|
|
|
|
|
|
for (walk = queue->ranges; walk; walk = walk->next) {
|
2010-07-07 06:20:21 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"range [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT "] (rb [%"
|
|
|
|
G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT "]), reading %" G_GUINT64_FORMAT
|
|
|
|
" current range? %s", walk->offset, walk->writing_pos, walk->rb_offset,
|
|
|
|
walk->rb_writing_pos, walk->reading_pos,
|
|
|
|
walk == queue->current ? "**y**" : " n ");
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear all the downloaded ranges */
|
|
|
|
static void
|
|
|
|
clean_ranges (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "clean queue ranges");
|
|
|
|
|
|
|
|
g_slice_free_chain (GstQueue2Range, queue->ranges, next);
|
|
|
|
queue->ranges = NULL;
|
|
|
|
queue->current = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find a range that contains @offset or NULL when nothing does */
|
|
|
|
static GstQueue2Range *
|
2010-10-13 09:54:04 +00:00
|
|
|
find_range (GstQueue2 * queue, guint64 offset)
|
2010-03-23 18:25:29 +00:00
|
|
|
{
|
2010-03-24 09:57:08 +00:00
|
|
|
GstQueue2Range *range = NULL;
|
|
|
|
GstQueue2Range *walk;
|
2010-03-23 18:25:29 +00:00
|
|
|
|
|
|
|
/* first do a quick check for the current range */
|
|
|
|
for (walk = queue->ranges; walk; walk = walk->next) {
|
|
|
|
if (offset >= walk->offset && offset <= walk->writing_pos) {
|
|
|
|
/* we can reuse an existing range */
|
|
|
|
range = walk;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-07-02 15:40:08 +00:00
|
|
|
if (range) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"found range for %" G_GUINT64_FORMAT ": [%" G_GUINT64_FORMAT "-%"
|
|
|
|
G_GUINT64_FORMAT "]", offset, range->offset, range->writing_pos);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue, "no range for %" G_GUINT64_FORMAT, offset);
|
|
|
|
}
|
2010-03-23 18:25:29 +00:00
|
|
|
return range;
|
|
|
|
}
|
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
static void
|
|
|
|
update_cur_level (GstQueue2 * queue, GstQueue2Range * range)
|
|
|
|
{
|
|
|
|
guint64 max_reading_pos, writing_pos;
|
|
|
|
|
|
|
|
writing_pos = range->writing_pos;
|
|
|
|
max_reading_pos = range->max_reading_pos;
|
|
|
|
|
|
|
|
if (writing_pos > max_reading_pos)
|
|
|
|
queue->cur_level.bytes = writing_pos - max_reading_pos;
|
|
|
|
else
|
|
|
|
queue->cur_level.bytes = 0;
|
|
|
|
}
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* make a new range for @offset or reuse an existing range */
|
|
|
|
static GstQueue2Range *
|
2012-05-24 12:08:16 +00:00
|
|
|
add_range (GstQueue2 * queue, guint64 offset, gboolean update_existing)
|
2010-03-23 18:25:29 +00:00
|
|
|
{
|
|
|
|
GstQueue2Range *range, *prev, *next;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "find range for %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
2010-10-13 09:54:04 +00:00
|
|
|
if ((range = find_range (queue, offset))) {
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"reusing range %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT, range->offset,
|
|
|
|
range->writing_pos);
|
2012-05-24 12:08:16 +00:00
|
|
|
if (update_existing && range->writing_pos != offset) {
|
|
|
|
GST_DEBUG_OBJECT (queue, "updating range writing position to "
|
|
|
|
"%" G_GUINT64_FORMAT, offset);
|
|
|
|
range->writing_pos = offset;
|
|
|
|
}
|
2010-03-23 18:25:29 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"new range %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT, offset, offset);
|
|
|
|
|
|
|
|
range = g_slice_new0 (GstQueue2Range);
|
|
|
|
range->offset = offset;
|
2010-05-07 07:30:44 +00:00
|
|
|
/* we want to write to the next location in the ring buffer */
|
|
|
|
range->rb_offset = queue->current ? queue->current->rb_writing_pos : 0;
|
2010-03-23 18:25:29 +00:00
|
|
|
range->writing_pos = offset;
|
2010-05-07 07:30:44 +00:00
|
|
|
range->rb_writing_pos = range->rb_offset;
|
2010-03-23 18:25:29 +00:00
|
|
|
range->reading_pos = offset;
|
|
|
|
range->max_reading_pos = offset;
|
|
|
|
|
|
|
|
/* insert sorted */
|
|
|
|
prev = NULL;
|
|
|
|
next = queue->ranges;
|
|
|
|
while (next) {
|
|
|
|
if (next->offset > offset) {
|
|
|
|
/* insert before next */
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"insert before range %p, offset %" G_GUINT64_FORMAT, next,
|
|
|
|
next->offset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* try next */
|
|
|
|
prev = next;
|
|
|
|
next = next->next;
|
|
|
|
}
|
|
|
|
range->next = next;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range;
|
|
|
|
else
|
|
|
|
queue->ranges = range;
|
|
|
|
}
|
|
|
|
debug_ranges (queue);
|
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
/* update the stats for this range */
|
|
|
|
update_cur_level (queue, range);
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
return range;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* clear and init the download ranges for offset 0 */
|
|
|
|
static void
|
|
|
|
init_ranges (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "init queue ranges");
|
|
|
|
|
|
|
|
/* get rid of all the current ranges */
|
|
|
|
clean_ranges (queue);
|
|
|
|
/* make a range for offset 0 */
|
2012-05-24 12:08:16 +00:00
|
|
|
queue->current = add_range (queue, 0, TRUE);
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* calculate the diff between running time on the sink and src of the queue.
|
|
|
|
* This is the total amount of time in the queue. */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
update_time_level (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2010-10-19 15:40:13 +00:00
|
|
|
if (queue->sink_tainted) {
|
|
|
|
queue->sinktime =
|
|
|
|
gst_segment_to_running_time (&queue->sink_segment, GST_FORMAT_TIME,
|
2011-05-13 16:07:24 +00:00
|
|
|
queue->sink_segment.position);
|
2010-10-19 15:40:13 +00:00
|
|
|
queue->sink_tainted = FALSE;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-10-19 15:40:13 +00:00
|
|
|
if (queue->src_tainted) {
|
|
|
|
queue->srctime =
|
|
|
|
gst_segment_to_running_time (&queue->src_segment, GST_FORMAT_TIME,
|
2011-05-13 16:07:24 +00:00
|
|
|
queue->src_segment.position);
|
2010-10-19 15:40:13 +00:00
|
|
|
queue->src_tainted = FALSE;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "sink %" GST_TIME_FORMAT ", src %" GST_TIME_FORMAT,
|
2010-10-19 15:40:13 +00:00
|
|
|
GST_TIME_ARGS (queue->sinktime), GST_TIME_ARGS (queue->srctime));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-04-13 15:26:54 +00:00
|
|
|
if (queue->sinktime != GST_CLOCK_TIME_NONE
|
|
|
|
&& queue->srctime != GST_CLOCK_TIME_NONE
|
|
|
|
&& queue->sinktime >= queue->srctime)
|
2010-10-19 15:40:13 +00:00
|
|
|
queue->cur_level.time = queue->sinktime - queue->srctime;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
else
|
|
|
|
queue->cur_level.time = 0;
|
|
|
|
}
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
/* take a SEGMENT event and apply the values to segment, updating the time
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
* level of queue. */
|
|
|
|
static void
|
2010-10-19 15:40:13 +00:00
|
|
|
apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * segment,
|
|
|
|
gboolean is_sink)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2011-05-18 14:56:13 +00:00
|
|
|
gst_event_copy_segment (event, segment);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
if (segment->format == GST_FORMAT_BYTES) {
|
2012-04-11 11:20:18 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue) && is_sink) {
|
2010-07-29 15:27:06 +00:00
|
|
|
/* start is where we'll be getting from and as such writing next */
|
2012-05-24 12:08:16 +00:00
|
|
|
queue->current = add_range (queue, segment->start, TRUE);
|
2010-07-29 15:27:06 +00:00
|
|
|
}
|
2007-06-28 10:21:19 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* now configure the values, we use these to track timestamps on the
|
|
|
|
* sinkpad. */
|
2011-05-13 16:07:24 +00:00
|
|
|
if (segment->format != GST_FORMAT_TIME) {
|
2015-12-12 04:52:57 +00:00
|
|
|
/* non-time format, pretend the current time segment is closed with a
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
* 0 start and unknown stop time. */
|
2011-05-13 16:07:24 +00:00
|
|
|
segment->format = GST_FORMAT_TIME;
|
|
|
|
segment->start = 0;
|
|
|
|
segment->stop = -1;
|
|
|
|
segment->time = 0;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "configured SEGMENT %" GST_SEGMENT_FORMAT, segment);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-10-19 15:40:13 +00:00
|
|
|
if (is_sink)
|
|
|
|
queue->sink_tainted = TRUE;
|
|
|
|
else
|
|
|
|
queue->src_tainted = TRUE;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* segment can update the time level of the queue */
|
|
|
|
update_time_level (queue);
|
|
|
|
}
|
|
|
|
|
2014-10-02 07:57:43 +00:00
|
|
|
static void
|
|
|
|
apply_gap (GstQueue2 * queue, GstEvent * event,
|
|
|
|
GstSegment * segment, gboolean is_sink)
|
|
|
|
{
|
|
|
|
GstClockTime timestamp;
|
|
|
|
GstClockTime duration;
|
|
|
|
|
|
|
|
gst_event_parse_gap (event, ×tamp, &duration);
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration)) {
|
|
|
|
timestamp += duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
segment->position = timestamp;
|
|
|
|
|
|
|
|
if (is_sink)
|
|
|
|
queue->sink_tainted = TRUE;
|
|
|
|
else
|
|
|
|
queue->src_tainted = TRUE;
|
|
|
|
|
|
|
|
/* calc diff with other end */
|
|
|
|
update_time_level (queue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-17 11:42:43 +00:00
|
|
|
static void
|
|
|
|
query_downstream_bitrate (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GstQuery *query = gst_query_new_bitrate ();
|
|
|
|
guint downstream_bitrate = 0;
|
2020-05-26 17:41:37 +00:00
|
|
|
gboolean changed;
|
2018-05-17 11:42:43 +00:00
|
|
|
|
|
|
|
if (gst_pad_peer_query (queue->srcpad, query)) {
|
|
|
|
gst_query_parse_bitrate (query, &downstream_bitrate);
|
|
|
|
GST_DEBUG_OBJECT (queue, "Got bitrate of %u from downstream",
|
|
|
|
downstream_bitrate);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue, "Failed to query bitrate from downstream");
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_query_unref (query);
|
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2020-05-26 17:41:37 +00:00
|
|
|
changed = queue->downstream_bitrate != downstream_bitrate;
|
2018-05-17 11:42:43 +00:00
|
|
|
queue->downstream_bitrate = downstream_bitrate;
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
2020-05-26 17:41:37 +00:00
|
|
|
if (changed) {
|
|
|
|
if (queue->use_buffering)
|
|
|
|
update_buffering (queue);
|
|
|
|
gst_queue2_post_buffering (queue);
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (queue), obj_props[PROP_BITRATE]);
|
|
|
|
}
|
2018-05-17 11:42:43 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* take a buffer and update segment, updating the time level of the queue. */
|
|
|
|
static void
|
2010-10-19 15:40:13 +00:00
|
|
|
apply_buffer (GstQueue2 * queue, GstBuffer * buffer, GstSegment * segment,
|
2015-11-11 14:14:34 +00:00
|
|
|
guint64 size, gboolean is_sink)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GstClockTime duration, timestamp;
|
|
|
|
|
2015-10-27 07:48:07 +00:00
|
|
|
timestamp = GST_BUFFER_DTS_OR_PTS (buffer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
duration = GST_BUFFER_DURATION (buffer);
|
|
|
|
|
2015-11-11 14:14:34 +00:00
|
|
|
/* If we have no duration, pick one from the bitrate if we can */
|
2018-05-17 11:42:43 +00:00
|
|
|
if (duration == GST_CLOCK_TIME_NONE) {
|
|
|
|
if (queue->use_tags_bitrate) {
|
|
|
|
guint bitrate =
|
|
|
|
is_sink ? queue->sink_tags_bitrate : queue->src_tags_bitrate;
|
|
|
|
if (bitrate)
|
|
|
|
duration = gst_util_uint64_scale (size, 8 * GST_SECOND, bitrate);
|
|
|
|
}
|
|
|
|
if (duration == GST_CLOCK_TIME_NONE && !is_sink && queue->use_bitrate_query) {
|
|
|
|
if (queue->downstream_bitrate > 0) {
|
|
|
|
duration =
|
|
|
|
gst_util_uint64_scale (size, 8 * GST_SECOND,
|
|
|
|
queue->downstream_bitrate);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (queue, "got bitrate %u resulting in estimated "
|
|
|
|
"duration %" GST_TIME_FORMAT, queue->downstream_bitrate,
|
|
|
|
GST_TIME_ARGS (duration));
|
|
|
|
}
|
|
|
|
}
|
2015-11-11 14:14:34 +00:00
|
|
|
}
|
|
|
|
|
2011-03-24 16:25:08 +00:00
|
|
|
/* if no timestamp is set, assume it's continuous with the previous
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
* time */
|
|
|
|
if (timestamp == GST_CLOCK_TIME_NONE)
|
2011-05-13 16:07:24 +00:00
|
|
|
timestamp = segment->position;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* add duration */
|
|
|
|
if (duration != GST_CLOCK_TIME_NONE)
|
|
|
|
timestamp += duration;
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "position updated to %" GST_TIME_FORMAT,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_TIME_ARGS (timestamp));
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
segment->position = timestamp;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-10-19 15:40:13 +00:00
|
|
|
if (is_sink)
|
|
|
|
queue->sink_tainted = TRUE;
|
|
|
|
else
|
|
|
|
queue->src_tainted = TRUE;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* calc diff with other end */
|
|
|
|
update_time_level (queue);
|
|
|
|
}
|
|
|
|
|
2015-11-11 14:14:34 +00:00
|
|
|
struct BufListData
|
|
|
|
{
|
|
|
|
GstClockTime timestamp;
|
|
|
|
guint bitrate;
|
|
|
|
};
|
|
|
|
|
2011-11-28 01:00:28 +00:00
|
|
|
static gboolean
|
|
|
|
buffer_list_apply_time (GstBuffer ** buf, guint idx, gpointer data)
|
2011-11-03 10:34:49 +00:00
|
|
|
{
|
2015-11-11 14:14:34 +00:00
|
|
|
struct BufListData *bld = data;
|
|
|
|
GstClockTime *timestamp = &bld->timestamp;
|
2015-10-27 07:48:07 +00:00
|
|
|
GstClockTime btime;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
2015-10-27 07:48:07 +00:00
|
|
|
GST_TRACE ("buffer %u has pts %" GST_TIME_FORMAT " dts %" GST_TIME_FORMAT
|
2011-11-28 01:00:28 +00:00
|
|
|
" duration %" GST_TIME_FORMAT, idx,
|
2015-10-27 07:48:07 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_PTS (*buf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DTS (*buf)),
|
2011-11-03 10:34:49 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (*buf)));
|
|
|
|
|
2015-10-27 07:48:07 +00:00
|
|
|
btime = GST_BUFFER_DTS_OR_PTS (*buf);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (btime))
|
|
|
|
*timestamp = btime;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (*buf))
|
|
|
|
*timestamp += GST_BUFFER_DURATION (*buf);
|
2015-11-11 14:14:34 +00:00
|
|
|
else if (bld->bitrate != 0) {
|
|
|
|
guint64 size = gst_buffer_get_size (*buf);
|
|
|
|
|
|
|
|
/* If we have no duration, pick one from the bitrate if we can */
|
|
|
|
*timestamp += gst_util_uint64_scale (bld->bitrate, 8 * GST_SECOND, size);
|
|
|
|
}
|
|
|
|
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
GST_TRACE ("ts now %" GST_TIME_FORMAT, GST_TIME_ARGS (*timestamp));
|
2011-11-28 01:00:28 +00:00
|
|
|
return TRUE;
|
2011-11-03 10:34:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* take a buffer list and update segment, updating the time level of the queue */
|
|
|
|
static void
|
|
|
|
apply_buffer_list (GstQueue2 * queue, GstBufferList * buffer_list,
|
|
|
|
GstSegment * segment, gboolean is_sink)
|
|
|
|
{
|
2015-11-11 14:14:34 +00:00
|
|
|
struct BufListData bld;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
/* if no timestamp is set, assume it's continuous with the previous time */
|
2015-11-11 14:14:34 +00:00
|
|
|
bld.timestamp = segment->position;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
2018-05-17 11:42:43 +00:00
|
|
|
bld.bitrate = 0;
|
2015-11-11 14:14:34 +00:00
|
|
|
if (queue->use_tags_bitrate) {
|
|
|
|
if (is_sink)
|
|
|
|
bld.bitrate = queue->sink_tags_bitrate;
|
|
|
|
else
|
|
|
|
bld.bitrate = queue->src_tags_bitrate;
|
2018-05-17 11:42:43 +00:00
|
|
|
}
|
|
|
|
if (!is_sink && bld.bitrate == 0 && queue->use_bitrate_query) {
|
|
|
|
bld.bitrate = queue->downstream_bitrate;
|
|
|
|
}
|
2015-11-11 14:14:34 +00:00
|
|
|
|
|
|
|
gst_buffer_list_foreach (buffer_list, buffer_list_apply_time, &bld);
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "last_stop updated to %" GST_TIME_FORMAT,
|
2015-11-11 14:14:34 +00:00
|
|
|
GST_TIME_ARGS (bld.timestamp));
|
2011-11-03 10:34:49 +00:00
|
|
|
|
2015-11-11 14:14:34 +00:00
|
|
|
segment->position = bld.timestamp;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
if (is_sink)
|
|
|
|
queue->sink_tainted = TRUE;
|
|
|
|
else
|
|
|
|
queue->src_tainted = TRUE;
|
|
|
|
|
|
|
|
/* calc diff with other end */
|
|
|
|
update_time_level (queue);
|
|
|
|
}
|
|
|
|
|
2016-01-06 19:50:21 +00:00
|
|
|
static inline gint
|
2016-08-03 13:27:40 +00:00
|
|
|
normalize_to_buffering_level (guint64 cur_level, guint64 max_level,
|
|
|
|
guint64 alt_max)
|
2016-01-06 19:50:21 +00:00
|
|
|
{
|
|
|
|
guint64 p;
|
|
|
|
|
|
|
|
if (max_level == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (alt_max > 0)
|
2016-08-03 13:27:40 +00:00
|
|
|
p = gst_util_uint64_scale (cur_level, MAX_BUFFERING_LEVEL,
|
|
|
|
MIN (max_level, alt_max));
|
2016-01-06 19:50:21 +00:00
|
|
|
else
|
2016-08-03 13:27:40 +00:00
|
|
|
p = gst_util_uint64_scale (cur_level, MAX_BUFFERING_LEVEL, max_level);
|
2016-01-06 19:50:21 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
return MIN (p, MAX_BUFFERING_LEVEL);
|
2016-01-06 19:50:21 +00:00
|
|
|
}
|
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
static gboolean
|
2016-08-03 13:27:40 +00:00
|
|
|
get_buffering_level (GstQueue2 * queue, gboolean * is_buffering,
|
|
|
|
gint * buffering_level)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2016-08-03 13:27:40 +00:00
|
|
|
gint buflevel, buflevel2;
|
2012-12-20 10:30:25 +00:00
|
|
|
|
2016-08-03 13:20:20 +00:00
|
|
|
if (queue->high_watermark <= 0) {
|
2016-08-03 13:27:40 +00:00
|
|
|
if (buffering_level)
|
|
|
|
*buffering_level = MAX_BUFFERING_LEVEL;
|
2012-12-20 10:30:25 +00:00
|
|
|
if (is_buffering)
|
|
|
|
*is_buffering = FALSE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2016-08-03 13:27:40 +00:00
|
|
|
#define GET_BUFFER_LEVEL_FOR_QUANTITY(format,alt_max) \
|
|
|
|
normalize_to_buffering_level (queue->cur_level.format,queue->max_level.format,(alt_max))
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2017-08-07 10:24:37 +00:00
|
|
|
if (queue->is_eos || queue->srcresult == GST_FLOW_NOT_LINKED) {
|
|
|
|
/* on EOS and NOT_LINKED we are always 100% full, we set the var
|
|
|
|
* here so that we can reuse the logic below to stop buffering */
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel = MAX_BUFFERING_LEVEL;
|
2017-08-07 10:24:37 +00:00
|
|
|
GST_LOG_OBJECT (queue, "we are %s", queue->is_eos ? "EOS" : "NOT_LINKED");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
2015-11-05 16:02:42 +00:00
|
|
|
GST_LOG_OBJECT (queue,
|
2018-05-17 11:42:43 +00:00
|
|
|
"Cur level bytes/time/rate-time/buffers %u/%" GST_TIME_FORMAT "/%"
|
|
|
|
GST_TIME_FORMAT "/%u", queue->cur_level.bytes,
|
|
|
|
GST_TIME_ARGS (queue->cur_level.time),
|
|
|
|
GST_TIME_ARGS (queue->cur_level.rate_time), queue->cur_level.buffers);
|
2015-11-05 16:02:42 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
/* figure out the buffering level we are filled, we take the max of all formats. */
|
2010-05-18 15:42:07 +00:00
|
|
|
if (!QUEUE_IS_USING_RING_BUFFER (queue)) {
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel = GET_BUFFER_LEVEL_FOR_QUANTITY (bytes, 0);
|
2010-05-18 15:42:07 +00:00
|
|
|
} else {
|
|
|
|
guint64 rb_size = queue->ring_buffer_max_size;
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel = GET_BUFFER_LEVEL_FOR_QUANTITY (bytes, rb_size);
|
2010-05-18 15:42:07 +00:00
|
|
|
}
|
2016-01-06 19:51:44 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel2 = GET_BUFFER_LEVEL_FOR_QUANTITY (time, 0);
|
|
|
|
buflevel = MAX (buflevel, buflevel2);
|
2016-01-06 19:51:44 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel2 = GET_BUFFER_LEVEL_FOR_QUANTITY (buffers, 0);
|
|
|
|
buflevel = MAX (buflevel, buflevel2);
|
2007-06-28 11:06:56 +00:00
|
|
|
|
|
|
|
/* also apply the rate estimate when we need to */
|
2016-01-06 19:51:44 +00:00
|
|
|
if (queue->use_rate_estimate) {
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel2 = GET_BUFFER_LEVEL_FOR_QUANTITY (rate_time, 0);
|
|
|
|
buflevel = MAX (buflevel, buflevel2);
|
2016-01-06 19:51:44 +00:00
|
|
|
}
|
2015-11-05 16:02:42 +00:00
|
|
|
|
|
|
|
/* Don't get to 0% unless we're really empty */
|
|
|
|
if (queue->cur_level.bytes > 0)
|
2016-08-03 13:27:40 +00:00
|
|
|
buflevel = MAX (1, buflevel);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2016-08-03 13:27:40 +00:00
|
|
|
#undef GET_BUFFER_LEVEL_FOR_QUANTITY
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
if (is_buffering)
|
|
|
|
*is_buffering = queue->is_buffering;
|
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
if (buffering_level)
|
|
|
|
*buffering_level = buflevel;
|
2008-04-09 21:40:17 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "buffering %d, level %d", queue->is_buffering,
|
|
|
|
buflevel);
|
2012-12-20 10:59:54 +00:00
|
|
|
|
2013-08-16 15:28:12 +00:00
|
|
|
return TRUE;
|
2012-12-20 10:30:25 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
static gint
|
|
|
|
convert_to_buffering_percent (GstQueue2 * queue, gint buffering_level)
|
|
|
|
{
|
|
|
|
int percent;
|
|
|
|
|
|
|
|
/* scale so that if buffering_level equals the high watermark,
|
|
|
|
* the percentage is 100% */
|
2016-08-03 13:20:20 +00:00
|
|
|
percent = buffering_level * 100 / queue->high_watermark;
|
2016-08-03 13:27:40 +00:00
|
|
|
/* clip */
|
|
|
|
if (percent > 100)
|
|
|
|
percent = 100;
|
|
|
|
|
|
|
|
return percent;
|
|
|
|
}
|
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
static void
|
|
|
|
get_buffering_stats (GstQueue2 * queue, gint percent, GstBufferingMode * mode,
|
|
|
|
gint * avg_in, gint * avg_out, gint64 * buffering_left)
|
|
|
|
{
|
|
|
|
if (mode) {
|
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
|
|
|
*mode = GST_BUFFERING_TIMESHIFT;
|
|
|
|
else
|
|
|
|
*mode = GST_BUFFERING_DOWNLOAD;
|
|
|
|
} else {
|
|
|
|
*mode = GST_BUFFERING_STREAM;
|
|
|
|
}
|
|
|
|
}
|
2012-07-19 08:54:16 +00:00
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
if (avg_in)
|
|
|
|
*avg_in = queue->byte_in_rate;
|
|
|
|
if (avg_out)
|
|
|
|
*avg_out = queue->byte_out_rate;
|
2012-07-19 10:14:29 +00:00
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
if (buffering_left) {
|
|
|
|
*buffering_left = (percent == 100 ? 0 : -1);
|
2012-07-19 10:14:29 +00:00
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
if (queue->use_rate_estimate) {
|
|
|
|
guint64 max, cur;
|
2010-09-15 11:29:52 +00:00
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
max = queue->max_level.rate_time;
|
|
|
|
cur = queue->cur_level.rate_time;
|
2008-04-11 01:25:01 +00:00
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
if (percent != 100 && max > cur)
|
|
|
|
*buffering_left = (max - cur) / 1000000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-19 08:54:16 +00:00
|
|
|
|
2016-08-12 14:15:25 +00:00
|
|
|
/* Called with the lock taken */
|
|
|
|
static GstMessage *
|
2020-06-04 09:21:45 +00:00
|
|
|
gst_queue2_get_buffering_message (GstQueue2 * queue, gint * percent)
|
2014-09-19 15:02:46 +00:00
|
|
|
{
|
|
|
|
GstMessage *msg = NULL;
|
|
|
|
if (queue->percent_changed) {
|
2018-05-17 11:09:36 +00:00
|
|
|
/* Don't change the buffering level if the sinkpad is waiting for
|
|
|
|
* space to become available. This prevents the situation where,
|
|
|
|
* upstream is pushing buffers larger than our limits so only 1 buffer
|
|
|
|
* is ever in the queue at a time.
|
|
|
|
* Changing the level causes a buffering message to be posted saying that
|
|
|
|
* we are buffering which the application may pause to wait for another
|
|
|
|
* 100% buffering message which would be posted very soon after the
|
|
|
|
* waiting sink thread adds it's buffer to the queue */
|
|
|
|
/* FIXME: This situation above can still occur later if
|
|
|
|
* the sink pad is waiting to push a serialized event into the queue and
|
|
|
|
* the queue becomes empty for a short period of time. */
|
|
|
|
if (!queue->waiting_del
|
|
|
|
&& queue->last_posted_buffering_percent != queue->buffering_percent) {
|
2020-06-04 09:21:45 +00:00
|
|
|
*percent = queue->buffering_percent;
|
2018-05-17 11:09:36 +00:00
|
|
|
|
2020-06-04 09:21:45 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "Going to post buffering: %d%%", *percent);
|
|
|
|
msg = gst_message_new_buffering (GST_OBJECT_CAST (queue), *percent);
|
2018-05-17 11:09:36 +00:00
|
|
|
|
|
|
|
gst_message_set_buffering_stats (msg, queue->mode, queue->avg_in,
|
|
|
|
queue->avg_out, queue->buffering_left);
|
|
|
|
}
|
2014-09-19 15:02:46 +00:00
|
|
|
}
|
2016-08-12 14:15:25 +00:00
|
|
|
|
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_queue2_post_buffering (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GstMessage *msg = NULL;
|
2020-06-04 09:21:45 +00:00
|
|
|
gint percent = -1;
|
2016-08-12 14:15:25 +00:00
|
|
|
|
|
|
|
g_mutex_lock (&queue->buffering_post_lock);
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2020-06-04 09:21:45 +00:00
|
|
|
msg = gst_queue2_get_buffering_message (queue, &percent);
|
2014-09-19 15:02:46 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
2019-10-04 14:57:29 +00:00
|
|
|
if (msg != NULL) {
|
|
|
|
if (gst_element_post_message (GST_ELEMENT_CAST (queue), msg)) {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
/* Set these states only if posting the message succeeded. Otherwise,
|
|
|
|
* this post attempt failed, and the next one won't be done, because
|
|
|
|
* gst_queue2_get_buffering_message() checks these states and decides
|
|
|
|
* based on their values that it won't produce a message. */
|
2020-06-04 09:21:45 +00:00
|
|
|
queue->last_posted_buffering_percent = percent;
|
|
|
|
if (percent == queue->buffering_percent)
|
|
|
|
queue->percent_changed = FALSE;
|
2019-10-04 14:57:29 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2020-06-04 09:21:45 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "successfully posted %d%% buffering message",
|
|
|
|
percent);
|
2019-10-04 14:57:29 +00:00
|
|
|
} else
|
|
|
|
GST_DEBUG_OBJECT (queue, "could not post buffering message");
|
|
|
|
}
|
2014-09-19 15:02:46 +00:00
|
|
|
|
|
|
|
g_mutex_unlock (&queue->buffering_post_lock);
|
|
|
|
}
|
|
|
|
|
2012-12-20 10:30:25 +00:00
|
|
|
static void
|
|
|
|
update_buffering (GstQueue2 * queue)
|
|
|
|
{
|
2016-08-03 13:27:40 +00:00
|
|
|
gint buffering_level, percent;
|
2012-07-19 10:14:29 +00:00
|
|
|
|
2013-09-06 18:09:46 +00:00
|
|
|
/* Ensure the variables used to calculate buffering state are up-to-date. */
|
2013-09-10 08:15:03 +00:00
|
|
|
if (queue->current)
|
|
|
|
update_cur_level (queue, queue->current);
|
2016-07-11 07:58:47 +00:00
|
|
|
update_in_rates (queue, FALSE);
|
2013-09-06 18:09:46 +00:00
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
if (!get_buffering_level (queue, NULL, &buffering_level))
|
2013-08-16 15:28:12 +00:00
|
|
|
return;
|
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
percent = convert_to_buffering_percent (queue, buffering_level);
|
|
|
|
|
2013-08-16 15:28:12 +00:00
|
|
|
if (queue->is_buffering) {
|
|
|
|
/* if we were buffering see if we reached the high watermark */
|
2014-11-23 08:45:24 +00:00
|
|
|
if (percent >= 100)
|
2013-08-16 15:28:12 +00:00
|
|
|
queue->is_buffering = FALSE;
|
2014-09-19 15:02:46 +00:00
|
|
|
|
|
|
|
SET_PERCENT (queue, percent);
|
2013-08-16 15:28:12 +00:00
|
|
|
} else {
|
|
|
|
/* we were not buffering, check if we need to start buffering if we drop
|
|
|
|
* below the low threshold */
|
2016-08-03 13:20:20 +00:00
|
|
|
if (buffering_level < queue->low_watermark) {
|
2013-08-16 15:28:12 +00:00
|
|
|
queue->is_buffering = TRUE;
|
2014-09-19 15:02:46 +00:00
|
|
|
SET_PERCENT (queue, percent);
|
2013-08-16 15:28:12 +00:00
|
|
|
}
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
reset_rate_timer (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
queue->bytes_in = 0;
|
|
|
|
queue->bytes_out = 0;
|
|
|
|
queue->byte_in_rate = 0.0;
|
2011-04-19 18:05:07 +00:00
|
|
|
queue->byte_in_period = 0;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->byte_out_rate = 0.0;
|
2015-02-23 03:16:19 +00:00
|
|
|
queue->last_update_in_rates_elapsed = 0.0;
|
2007-12-14 18:46:12 +00:00
|
|
|
queue->last_in_elapsed = 0.0;
|
|
|
|
queue->last_out_elapsed = 0.0;
|
|
|
|
queue->in_timer_started = FALSE;
|
|
|
|
queue->out_timer_started = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2007-06-28 10:21:19 +00:00
|
|
|
/* the interval in seconds to recalculate the rate */
|
|
|
|
#define RATE_INTERVAL 0.2
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* Tuning for rate estimation. We use a large window for the input rate because
|
|
|
|
* it should be stable when connected to a network. The output rate is less
|
|
|
|
* stable (the elements preroll, queues behind a demuxer fill, ...) and should
|
2011-04-19 18:05:07 +00:00
|
|
|
* therefore adapt more quickly.
|
|
|
|
* However, initial input rate may be subject to a burst, and should therefore
|
|
|
|
* initially also adapt more quickly to changes, and only later on give higher
|
|
|
|
* weight to previous values. */
|
|
|
|
#define AVG_IN(avg,val,w1,w2) ((avg) * (w1) + (val) * (w2)) / ((w1) + (w2))
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
#define AVG_OUT(avg,val) ((avg) * 3.0 + (val)) / 4.0
|
|
|
|
|
|
|
|
static void
|
2016-07-11 07:58:47 +00:00
|
|
|
update_in_rates (GstQueue2 * queue, gboolean force)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gdouble elapsed, period;
|
|
|
|
gdouble byte_in_rate;
|
|
|
|
|
2007-12-14 18:46:12 +00:00
|
|
|
if (!queue->in_timer_started) {
|
|
|
|
queue->in_timer_started = TRUE;
|
|
|
|
g_timer_start (queue->in_timer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-23 03:16:19 +00:00
|
|
|
queue->last_update_in_rates_elapsed = elapsed =
|
|
|
|
g_timer_elapsed (queue->in_timer, NULL);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* recalc after each interval. */
|
2016-07-11 07:58:47 +00:00
|
|
|
if (force || queue->last_in_elapsed + RATE_INTERVAL < elapsed) {
|
2007-12-14 18:46:12 +00:00
|
|
|
period = elapsed - queue->last_in_elapsed;
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
2011-04-19 18:05:07 +00:00
|
|
|
"rates: period %f, in %" G_GUINT64_FORMAT ", global period %f",
|
|
|
|
period, queue->bytes_in, queue->byte_in_period);
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
|
|
|
|
byte_in_rate = queue->bytes_in / period;
|
|
|
|
|
|
|
|
if (queue->byte_in_rate == 0.0)
|
|
|
|
queue->byte_in_rate = byte_in_rate;
|
|
|
|
else
|
2011-04-19 18:05:07 +00:00
|
|
|
queue->byte_in_rate = AVG_IN (queue->byte_in_rate, byte_in_rate,
|
|
|
|
(double) queue->byte_in_period, period);
|
|
|
|
|
|
|
|
/* another data point, cap at 16 for long time running average */
|
|
|
|
if (queue->byte_in_period < 16 * RATE_INTERVAL)
|
|
|
|
queue->byte_in_period += period;
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
|
|
|
|
/* reset the values to calculate rate over the next interval */
|
2007-12-14 18:46:12 +00:00
|
|
|
queue->last_in_elapsed = elapsed;
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
queue->bytes_in = 0;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2018-05-17 11:42:43 +00:00
|
|
|
if (queue->use_bitrate_query && queue->downstream_bitrate > 0) {
|
|
|
|
queue->cur_level.rate_time =
|
|
|
|
gst_util_uint64_scale (8 * queue->cur_level.bytes, GST_SECOND,
|
|
|
|
queue->downstream_bitrate);
|
|
|
|
GST_LOG_OBJECT (queue,
|
|
|
|
"got bitrate %u with byte level %u resulting in time %"
|
|
|
|
GST_TIME_FORMAT, queue->downstream_bitrate, queue->cur_level.bytes,
|
|
|
|
GST_TIME_ARGS (queue->cur_level.rate_time));
|
|
|
|
} else if (queue->byte_in_rate > 0.0) {
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
queue->cur_level.rate_time =
|
|
|
|
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND;
|
|
|
|
}
|
2007-12-14 18:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "rates: in %f, time %" GST_TIME_FORMAT,
|
|
|
|
queue->byte_in_rate, GST_TIME_ARGS (queue->cur_level.rate_time));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
update_out_rates (GstQueue2 * queue)
|
2007-12-14 18:46:12 +00:00
|
|
|
{
|
|
|
|
gdouble elapsed, period;
|
|
|
|
gdouble byte_out_rate;
|
|
|
|
|
|
|
|
if (!queue->out_timer_started) {
|
|
|
|
queue->out_timer_started = TRUE;
|
|
|
|
g_timer_start (queue->out_timer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
elapsed = g_timer_elapsed (queue->out_timer, NULL);
|
|
|
|
|
|
|
|
/* recalc after each interval. */
|
|
|
|
if (queue->last_out_elapsed + RATE_INTERVAL < elapsed) {
|
|
|
|
period = elapsed - queue->last_out_elapsed;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2007-12-14 18:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"rates: period %f, out %" G_GUINT64_FORMAT, period, queue->bytes_out);
|
|
|
|
|
|
|
|
byte_out_rate = queue->bytes_out / period;
|
|
|
|
|
|
|
|
if (queue->byte_out_rate == 0.0)
|
|
|
|
queue->byte_out_rate = byte_out_rate;
|
|
|
|
else
|
|
|
|
queue->byte_out_rate = AVG_OUT (queue->byte_out_rate, byte_out_rate);
|
|
|
|
|
|
|
|
/* reset the values to calculate rate over the next interval */
|
|
|
|
queue->last_out_elapsed = elapsed;
|
|
|
|
queue->bytes_out = 0;
|
|
|
|
}
|
2008-04-02 11:08:05 +00:00
|
|
|
if (queue->byte_in_rate > 0.0) {
|
|
|
|
queue->cur_level.rate_time =
|
|
|
|
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND;
|
|
|
|
}
|
2007-12-14 18:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "rates: out %f, time %" GST_TIME_FORMAT,
|
|
|
|
queue->byte_out_rate, GST_TIME_ARGS (queue->cur_level.rate_time));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-03-25 16:21:02 +00:00
|
|
|
static void
|
|
|
|
update_cur_pos (GstQueue2 * queue, GstQueue2Range * range, guint64 pos)
|
|
|
|
{
|
|
|
|
guint64 reading_pos, max_reading_pos;
|
|
|
|
|
|
|
|
reading_pos = pos;
|
|
|
|
max_reading_pos = range->max_reading_pos;
|
|
|
|
|
|
|
|
max_reading_pos = MAX (max_reading_pos, reading_pos);
|
|
|
|
|
2010-06-28 15:50:06 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
2010-07-02 15:40:08 +00:00
|
|
|
"updating max_reading_pos from %" G_GUINT64_FORMAT " to %"
|
|
|
|
G_GUINT64_FORMAT, range->max_reading_pos, max_reading_pos);
|
2010-03-25 16:21:02 +00:00
|
|
|
range->max_reading_pos = max_reading_pos;
|
|
|
|
|
|
|
|
update_cur_level (queue, range);
|
|
|
|
}
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
static gboolean
|
|
|
|
perform_seek_to_offset (GstQueue2 * queue, guint64 offset)
|
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
gboolean res;
|
|
|
|
|
2012-04-10 10:09:53 +00:00
|
|
|
/* until we receive the FLUSH_STOP from this seek, we skip data */
|
|
|
|
queue->seeking = TRUE;
|
2010-10-19 15:43:56 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
2014-02-18 13:21:20 +00:00
|
|
|
debug_ranges (queue);
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "Seeking to %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
|
|
event =
|
|
|
|
gst_event_new_seek (1.0, GST_FORMAT_BYTES,
|
|
|
|
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, GST_SEEK_TYPE_SET, offset,
|
|
|
|
GST_SEEK_TYPE_NONE, -1);
|
|
|
|
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
|
2012-05-24 12:08:16 +00:00
|
|
|
if (res) {
|
|
|
|
/* Between us sending the seek event and re-acquiring the lock, the source
|
|
|
|
* thread might already have pushed data and moved along the range's
|
|
|
|
* writing_pos beyond the seek offset. In that case we don't want to set
|
|
|
|
* the writing position back to the requested seek position, as it would
|
|
|
|
* cause data to be written to the wrong offset in the file or ring buffer.
|
|
|
|
* We still do the add_range call to switch the current range to the
|
|
|
|
* requested range, or create one if one doesn't exist yet. */
|
|
|
|
queue->current = add_range (queue, offset, FALSE);
|
|
|
|
}
|
2010-06-16 14:13:28 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
return res;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
|
2014-02-18 13:21:20 +00:00
|
|
|
/* get the threshold for when we decide to seek rather than wait */
|
|
|
|
static guint64
|
|
|
|
get_seek_threshold (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
guint64 threshold;
|
|
|
|
|
|
|
|
/* FIXME, find a good threshold based on the incoming rate. */
|
|
|
|
threshold = 1024 * 512;
|
|
|
|
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
threshold = MIN (threshold,
|
|
|
|
QUEUE_MAX_BYTES (queue) - queue->cur_level.bytes);
|
|
|
|
}
|
|
|
|
return threshold;
|
|
|
|
}
|
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* see if there is enough data in the file to read a full buffer */
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
2010-03-23 18:25:29 +00:00
|
|
|
GstQueue2Range *range;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2010-03-25 16:21:02 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "looking for offset %" G_GUINT64_FORMAT ", len %u",
|
|
|
|
offset, length);
|
2010-03-23 18:25:29 +00:00
|
|
|
|
2010-10-13 09:54:04 +00:00
|
|
|
if ((range = find_range (queue, offset))) {
|
2010-03-23 18:25:29 +00:00
|
|
|
if (queue->current != range) {
|
2010-03-25 16:21:02 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "switching ranges, do seek to range position");
|
2010-03-23 18:25:29 +00:00
|
|
|
perform_seek_to_offset (queue, range->writing_pos);
|
|
|
|
}
|
2010-03-25 16:21:02 +00:00
|
|
|
|
2010-08-19 07:58:55 +00:00
|
|
|
GST_INFO_OBJECT (queue, "cur_level.bytes %u (max %" G_GUINT64_FORMAT ")",
|
2010-06-16 15:03:49 +00:00
|
|
|
queue->cur_level.bytes, QUEUE_MAX_BYTES (queue));
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* we have a range for offset */
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"we have a range %p, offset %" G_GUINT64_FORMAT ", writing_pos %"
|
|
|
|
G_GUINT64_FORMAT, range, range->offset, range->writing_pos);
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
if (!QUEUE_IS_USING_RING_BUFFER (queue) && queue->is_eos)
|
2010-03-23 18:25:29 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2010-05-26 02:11:48 +00:00
|
|
|
if (offset + length <= range->writing_pos)
|
2010-03-23 18:25:29 +00:00
|
|
|
return TRUE;
|
2010-05-19 14:04:15 +00:00
|
|
|
else
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Need more data (%" G_GUINT64_FORMAT " bytes more)",
|
2010-06-06 07:30:48 +00:00
|
|
|
(offset + length) - range->writing_pos);
|
2010-03-23 18:25:29 +00:00
|
|
|
|
|
|
|
} else {
|
2012-04-04 11:07:27 +00:00
|
|
|
GST_INFO_OBJECT (queue, "not found in any range off %" G_GUINT64_FORMAT
|
|
|
|
" len %u", offset, length);
|
|
|
|
/* we don't have the range, see how far away we are */
|
2010-06-07 08:16:04 +00:00
|
|
|
if (!queue->is_eos && queue->current) {
|
2014-02-18 13:21:20 +00:00
|
|
|
guint64 threshold = get_seek_threshold (queue);
|
2012-04-04 11:07:27 +00:00
|
|
|
|
2013-07-29 13:48:32 +00:00
|
|
|
if (offset >= queue->current->offset && offset <=
|
|
|
|
queue->current->writing_pos + threshold) {
|
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"requested data is within range, wait for data");
|
2010-08-26 15:04:20 +00:00
|
|
|
return FALSE;
|
2010-03-25 16:21:02 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-24 17:18:13 +00:00
|
|
|
|
|
|
|
/* too far away, do a seek */
|
2010-03-23 18:25:29 +00:00
|
|
|
perform_seek_to_offset (queue, offset);
|
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
#ifdef HAVE_FSEEKO
|
|
|
|
#define FSEEK_FILE(file,offset) (fseeko (file, (off_t) offset, SEEK_SET) != 0)
|
|
|
|
#elif defined (G_OS_UNIX) || defined (G_OS_WIN32)
|
|
|
|
#define FSEEK_FILE(file,offset) (lseek (fileno (file), (off_t) offset, SEEK_SET) == (off_t) -1)
|
|
|
|
#else
|
|
|
|
#define FSEEK_FILE(file,offset) (fseek (file, offset, SEEK_SET) != 0)
|
|
|
|
#endif
|
|
|
|
|
2011-04-25 08:56:06 +00:00
|
|
|
static GstFlowReturn
|
2010-05-07 07:30:44 +00:00
|
|
|
gst_queue2_read_data_at_offset (GstQueue2 * queue, guint64 offset, guint length,
|
2011-04-25 08:56:06 +00:00
|
|
|
guint8 * dst, gint64 * read_return)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
2010-06-18 15:43:40 +00:00
|
|
|
guint8 *ring_buffer;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
size_t res;
|
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
ring_buffer = queue->ring_buffer;
|
|
|
|
|
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue) && FSEEK_FILE (queue->temp_file, offset))
|
2007-06-06 09:08:50 +00:00
|
|
|
goto seek_failed;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
/* this should not block */
|
2010-05-07 07:30:44 +00:00
|
|
|
GST_LOG_OBJECT (queue, "Reading %d bytes from offset %" G_GUINT64_FORMAT,
|
|
|
|
length, offset);
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
res = fread (dst, 1, length, queue->temp_file);
|
|
|
|
} else {
|
|
|
|
memcpy (dst, ring_buffer + offset, length);
|
|
|
|
res = length;
|
|
|
|
}
|
|
|
|
|
2007-06-13 18:20:57 +00:00
|
|
|
GST_LOG_OBJECT (queue, "read %" G_GSIZE_FORMAT " bytes", res);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
if (G_UNLIKELY (res < length)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (!QUEUE_IS_USING_TEMP_FILE (queue))
|
|
|
|
goto could_not_read;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* check for errors or EOF */
|
|
|
|
if (ferror (queue->temp_file))
|
|
|
|
goto could_not_read;
|
|
|
|
if (feof (queue->temp_file) && length > 0)
|
|
|
|
goto eos;
|
|
|
|
}
|
|
|
|
|
2011-04-25 08:56:06 +00:00
|
|
|
*read_return = res;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
seek_failed:
|
|
|
|
{
|
2010-06-15 10:37:33 +00:00
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, SEEK, (NULL), GST_ERROR_SYSTEM);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
could_not_read:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("non-regular file hits EOS");
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
|
|
|
GstBuffer ** buffer)
|
|
|
|
{
|
|
|
|
GstBuffer *buf;
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *data;
|
2010-05-07 07:30:44 +00:00
|
|
|
guint64 file_offset;
|
2010-06-06 07:30:48 +00:00
|
|
|
guint block_length, remaining, read_length;
|
2010-06-16 15:03:49 +00:00
|
|
|
guint64 rb_size;
|
2012-04-05 07:56:52 +00:00
|
|
|
guint64 max_size;
|
2010-06-18 12:36:33 +00:00
|
|
|
guint64 rpos;
|
2011-04-25 08:56:06 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
/* allocate the output buffer of the requested size */
|
2012-03-20 12:14:55 +00:00
|
|
|
if (*buffer == NULL)
|
|
|
|
buf = gst_buffer_new_allocate (NULL, length, NULL);
|
|
|
|
else
|
|
|
|
buf = *buffer;
|
|
|
|
|
2014-04-16 09:39:15 +00:00
|
|
|
if (!gst_buffer_map (buf, &info, GST_MAP_WRITE))
|
|
|
|
goto buffer_write_fail;
|
2012-01-20 13:23:57 +00:00
|
|
|
data = info.data;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "Reading %u bytes from %" G_GUINT64_FORMAT, length,
|
|
|
|
offset);
|
|
|
|
|
2010-06-28 15:50:06 +00:00
|
|
|
rpos = offset;
|
2010-06-16 15:03:49 +00:00
|
|
|
rb_size = queue->ring_buffer_max_size;
|
2012-04-05 07:56:52 +00:00
|
|
|
max_size = QUEUE_MAX_BYTES (queue);
|
2010-06-16 15:03:49 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
remaining = length;
|
|
|
|
while (remaining > 0) {
|
|
|
|
/* configure how much/whether to read */
|
2010-06-18 12:36:33 +00:00
|
|
|
if (!gst_queue2_have_data (queue, rpos, remaining)) {
|
2010-06-16 09:11:11 +00:00
|
|
|
read_length = 0;
|
|
|
|
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
2010-06-16 09:20:00 +00:00
|
|
|
guint64 level;
|
|
|
|
|
|
|
|
/* calculate how far away the offset is */
|
2010-06-18 12:36:33 +00:00
|
|
|
if (queue->current->writing_pos > rpos)
|
|
|
|
level = queue->current->writing_pos - rpos;
|
2010-06-16 09:20:00 +00:00
|
|
|
else
|
|
|
|
level = 0;
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
2010-06-16 09:20:00 +00:00
|
|
|
"reading %" G_GUINT64_FORMAT ", writing %" G_GUINT64_FORMAT
|
2012-04-05 07:56:52 +00:00
|
|
|
", level %" G_GUINT64_FORMAT ", max %" G_GUINT64_FORMAT,
|
|
|
|
rpos, queue->current->writing_pos, level, max_size);
|
2010-06-16 09:20:00 +00:00
|
|
|
|
2012-04-05 07:56:52 +00:00
|
|
|
if (level >= max_size) {
|
2010-06-16 09:11:11 +00:00
|
|
|
/* we don't have the data but if we have a ring buffer that is full, we
|
|
|
|
* need to read */
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
2012-04-05 07:56:52 +00:00
|
|
|
"ring buffer full, reading QUEUE_MAX_BYTES %"
|
|
|
|
G_GUINT64_FORMAT " bytes", max_size);
|
|
|
|
read_length = max_size;
|
2010-07-02 15:40:08 +00:00
|
|
|
} else if (queue->is_eos) {
|
|
|
|
/* won't get any more data so read any data we have */
|
|
|
|
if (level) {
|
2010-08-19 07:58:55 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"EOS hit but read %" G_GUINT64_FORMAT " bytes that we have",
|
2010-07-02 15:40:08 +00:00
|
|
|
level);
|
|
|
|
read_length = level;
|
2012-04-05 08:03:02 +00:00
|
|
|
remaining = level;
|
|
|
|
length = level;
|
2011-04-25 08:56:06 +00:00
|
|
|
} else
|
|
|
|
goto hit_eos;
|
2010-06-16 09:11:11 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 12:36:33 +00:00
|
|
|
|
2010-06-16 09:11:11 +00:00
|
|
|
if (read_length == 0) {
|
2012-04-11 10:02:50 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
2010-06-28 15:50:06 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
2012-04-11 10:02:50 +00:00
|
|
|
"update current position [%" G_GUINT64_FORMAT "-%"
|
|
|
|
G_GUINT64_FORMAT "]", rpos, queue->current->max_reading_pos);
|
|
|
|
update_cur_pos (queue, queue->current, rpos);
|
2012-04-11 10:34:55 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
2010-06-18 12:36:33 +00:00
|
|
|
}
|
2013-09-06 18:09:46 +00:00
|
|
|
|
|
|
|
if (queue->use_buffering)
|
|
|
|
update_buffering (queue);
|
|
|
|
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "waiting for add");
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
|
|
|
continue;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
} else {
|
2010-06-06 07:30:48 +00:00
|
|
|
/* we have the requested data so read it */
|
|
|
|
read_length = remaining;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2010-07-02 15:40:08 +00:00
|
|
|
/* set range reading_pos to actual reading position for this read */
|
|
|
|
queue->current->reading_pos = rpos;
|
|
|
|
|
2011-09-07 11:14:38 +00:00
|
|
|
/* configure how much and from where to read */
|
2010-06-06 07:30:48 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
file_offset =
|
2010-06-18 12:36:33 +00:00
|
|
|
(queue->current->rb_offset + (rpos -
|
2010-06-16 15:03:49 +00:00
|
|
|
queue->current->offset)) % rb_size;
|
|
|
|
if (file_offset + read_length > rb_size) {
|
|
|
|
block_length = rb_size - file_offset;
|
2010-06-06 07:30:48 +00:00
|
|
|
} else {
|
|
|
|
block_length = read_length;
|
|
|
|
}
|
|
|
|
} else {
|
2010-06-18 12:36:33 +00:00
|
|
|
file_offset = rpos;
|
2010-06-06 07:30:48 +00:00
|
|
|
block_length = read_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* while we still have data to read, we loop */
|
|
|
|
while (read_length > 0) {
|
2011-04-25 08:56:06 +00:00
|
|
|
gint64 read_return;
|
|
|
|
|
|
|
|
ret =
|
2010-05-07 07:30:44 +00:00
|
|
|
gst_queue2_read_data_at_offset (queue, file_offset, block_length,
|
2011-04-25 08:56:06 +00:00
|
|
|
data, &read_return);
|
|
|
|
if (ret != GST_FLOW_OK)
|
2010-06-15 14:12:02 +00:00
|
|
|
goto read_error;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
file_offset += read_return;
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
2010-06-16 15:03:49 +00:00
|
|
|
file_offset %= rb_size;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
data += read_return;
|
|
|
|
read_length -= read_return;
|
|
|
|
block_length = read_length;
|
|
|
|
remaining -= read_return;
|
2010-06-16 09:20:00 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
rpos = (queue->current->reading_pos += read_return);
|
|
|
|
update_cur_pos (queue, queue->current, queue->current->reading_pos);
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
|
|
|
GST_DEBUG_OBJECT (queue, "%u bytes left to read", remaining);
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buf, &info);
|
|
|
|
gst_buffer_resize (buf, 0, length);
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
GST_BUFFER_OFFSET (buf) = offset;
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = offset + length;
|
|
|
|
|
|
|
|
*buffer = buf;
|
|
|
|
|
2011-04-25 08:56:06 +00:00
|
|
|
return ret;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
2011-04-25 08:56:06 +00:00
|
|
|
hit_eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "EOS hit and we don't have any requested data");
|
2012-01-27 14:32:37 +00:00
|
|
|
gst_buffer_unmap (buf, &info);
|
2012-03-20 12:14:55 +00:00
|
|
|
if (*buffer == NULL)
|
|
|
|
gst_buffer_unref (buf);
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2011-04-25 08:56:06 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "we are flushing");
|
2012-01-27 14:32:37 +00:00
|
|
|
gst_buffer_unmap (buf, &info);
|
2012-03-20 12:14:55 +00:00
|
|
|
if (*buffer == NULL)
|
|
|
|
gst_buffer_unref (buf);
|
2012-02-08 14:16:46 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
2010-06-15 14:12:02 +00:00
|
|
|
read_error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "we have a read error");
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buf, &info);
|
2012-03-20 12:14:55 +00:00
|
|
|
if (*buffer == NULL)
|
|
|
|
gst_buffer_unref (buf);
|
2011-04-25 08:56:06 +00:00
|
|
|
return ret;
|
2010-06-15 14:12:02 +00:00
|
|
|
}
|
2014-04-16 09:39:15 +00:00
|
|
|
buffer_write_fail:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, WRITE, (NULL),
|
|
|
|
("Can't write to buffer"));
|
|
|
|
if (*buffer == NULL)
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* should be called with QUEUE_LOCK */
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
static GstMiniObject *
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_read_item_from_file (GstQueue2 * queue)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GstMiniObject *item;
|
|
|
|
|
2012-01-27 11:33:32 +00:00
|
|
|
if (queue->stream_start_event != NULL) {
|
|
|
|
item = GST_MINI_OBJECT_CAST (queue->stream_start_event);
|
|
|
|
queue->stream_start_event = NULL;
|
|
|
|
} else if (queue->starting_segment != NULL) {
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
item = GST_MINI_OBJECT_CAST (queue->starting_segment);
|
|
|
|
queue->starting_segment = NULL;
|
|
|
|
} else {
|
|
|
|
GstFlowReturn ret;
|
2012-03-20 12:14:55 +00:00
|
|
|
GstBuffer *buffer = NULL;
|
2010-03-23 18:25:29 +00:00
|
|
|
guint64 reading_pos;
|
|
|
|
|
|
|
|
reading_pos = queue->current->reading_pos;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
ret =
|
2010-03-23 18:25:29 +00:00
|
|
|
gst_queue2_create_read (queue, reading_pos, DEFAULT_BUFFER_SIZE,
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
&buffer);
|
2010-06-15 14:12:02 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
switch (ret) {
|
|
|
|
case GST_FLOW_OK:
|
|
|
|
item = GST_MINI_OBJECT_CAST (buffer);
|
|
|
|
break;
|
2011-10-10 09:33:51 +00:00
|
|
|
case GST_FLOW_EOS:
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
item = GST_MINI_OBJECT_CAST (gst_event_new_eos ());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
item = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2010-10-11 16:10:07 +00:00
|
|
|
/* must be called with MUTEX_LOCK. Will briefly release the lock when notifying
|
|
|
|
* the temp filename. */
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_open_temp_location_file (GstQueue2 * queue)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
2009-07-10 18:49:46 +00:00
|
|
|
gint fd = -1;
|
|
|
|
gchar *name = NULL;
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
if (queue->temp_file)
|
|
|
|
goto already_opened;
|
|
|
|
|
2009-07-10 18:49:46 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "opening temp file %s", queue->temp_template);
|
|
|
|
|
2015-12-12 04:52:57 +00:00
|
|
|
/* If temp_template was set, allocate a filename and open that file */
|
2008-04-02 11:08:05 +00:00
|
|
|
|
2012-07-06 09:07:56 +00:00
|
|
|
/* nothing to do */
|
|
|
|
if (queue->temp_template == NULL)
|
|
|
|
goto no_directory;
|
|
|
|
|
|
|
|
/* make copy of the template, we don't want to change this */
|
|
|
|
name = g_strdup (queue->temp_template);
|
2015-12-12 04:42:05 +00:00
|
|
|
|
|
|
|
#ifdef __BIONIC__
|
|
|
|
fd = g_mkstemp_full (name, O_RDWR | O_LARGEFILE, S_IRUSR | S_IWUSR);
|
|
|
|
#else
|
2012-07-06 09:07:56 +00:00
|
|
|
fd = g_mkstemp (name);
|
2015-12-12 04:42:05 +00:00
|
|
|
#endif
|
|
|
|
|
2012-07-06 09:07:56 +00:00
|
|
|
if (fd == -1)
|
|
|
|
goto mkstemp_failed;
|
|
|
|
|
|
|
|
/* open the file for update/writing */
|
|
|
|
queue->temp_file = fdopen (fd, "wb+");
|
|
|
|
/* error creating file */
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
goto open_failed;
|
2010-10-11 16:10:07 +00:00
|
|
|
|
2012-07-06 09:07:56 +00:00
|
|
|
g_free (queue->temp_location);
|
|
|
|
queue->temp_location = name;
|
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* we can't emit the notify with the lock */
|
2019-10-31 10:06:48 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (queue), obj_props[PROP_TEMP_LOCATION]);
|
2012-07-06 09:07:56 +00:00
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2010-10-11 16:10:07 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "opened temp file %s", queue->temp_template);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
2010-03-23 18:25:29 +00:00
|
|
|
already_opened:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "temp file was already open");
|
|
|
|
return TRUE;
|
|
|
|
}
|
2009-07-10 18:49:46 +00:00
|
|
|
no_directory:
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, NOT_FOUND,
|
2009-07-10 18:49:46 +00:00
|
|
|
(_("No Temp directory specified.")), (NULL));
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-07-10 18:49:46 +00:00
|
|
|
mkstemp_failed:
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, OPEN_READ,
|
2009-07-10 18:49:46 +00:00
|
|
|
(_("Could not create temp file \"%s\"."), queue->temp_template),
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
GST_ERROR_SYSTEM);
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, OPEN_READ,
|
|
|
|
(_("Could not open file \"%s\" for reading."), name), GST_ERROR_SYSTEM);
|
|
|
|
g_free (name);
|
|
|
|
if (fd != -1)
|
|
|
|
close (fd);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_close_temp_location_file (GstQueue2 * queue)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
/* nothing to do */
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
return;
|
2008-04-09 21:40:17 +00:00
|
|
|
|
2008-04-02 11:08:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "closing temp file");
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
fflush (queue->temp_file);
|
|
|
|
fclose (queue->temp_file);
|
2010-01-22 16:55:39 +00:00
|
|
|
|
2014-04-07 16:33:34 +00:00
|
|
|
if (queue->temp_remove) {
|
|
|
|
if (remove (queue->temp_location) < 0) {
|
|
|
|
GST_WARNING_OBJECT (queue, "Failed to remove temporary file %s: %s",
|
2014-04-07 16:49:14 +00:00
|
|
|
queue->temp_location, g_strerror (errno));
|
2014-04-07 16:33:34 +00:00
|
|
|
}
|
|
|
|
}
|
2010-01-22 16:55:39 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
queue->temp_file = NULL;
|
2010-03-23 18:25:29 +00:00
|
|
|
clean_ranges (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
|
2009-07-10 20:01:39 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_flush_temp_file (GstQueue2 * queue)
|
2009-07-10 20:01:39 +00:00
|
|
|
{
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "flushing temp file");
|
|
|
|
|
|
|
|
queue->temp_file = g_freopen (queue->temp_location, "wb+", queue->temp_file);
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2014-02-18 14:46:32 +00:00
|
|
|
gst_queue2_locked_flush (GstQueue2 * queue, gboolean full, gboolean clear_temp)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2014-02-18 14:46:32 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue) && clear_temp)
|
2010-06-18 15:43:40 +00:00
|
|
|
gst_queue2_flush_temp_file (queue);
|
|
|
|
init_ranges (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
} else {
|
2018-06-02 12:02:19 +00:00
|
|
|
GstQueue2Item *qitem;
|
2013-05-27 13:41:14 +00:00
|
|
|
|
2018-06-02 12:02:19 +00:00
|
|
|
while ((qitem = gst_queue_array_pop_head_struct (queue->queue))) {
|
2013-05-27 13:41:14 +00:00
|
|
|
if (!full && qitem->type == GST_QUEUE2_ITEM_TYPE_EVENT
|
|
|
|
&& GST_EVENT_IS_STICKY (qitem->item)
|
|
|
|
&& GST_EVENT_TYPE (qitem->item) != GST_EVENT_SEGMENT
|
|
|
|
&& GST_EVENT_TYPE (qitem->item) != GST_EVENT_EOS) {
|
|
|
|
gst_pad_store_sticky_event (queue->srcpad,
|
|
|
|
GST_EVENT_CAST (qitem->item));
|
2013-05-27 11:01:43 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* Then lose another reference because we are supposed to destroy that
|
|
|
|
data when flushing */
|
2013-05-27 13:41:14 +00:00
|
|
|
if (qitem->type != GST_QUEUE2_ITEM_TYPE_QUERY)
|
|
|
|
gst_mini_object_unref (qitem->item);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2013-05-24 17:22:22 +00:00
|
|
|
queue->last_query = FALSE;
|
2013-05-27 14:08:39 +00:00
|
|
|
g_cond_signal (&queue->query_handled);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_segment_init (&queue->sink_segment, GST_FORMAT_TIME);
|
|
|
|
gst_segment_init (&queue->src_segment, GST_FORMAT_TIME);
|
2010-10-19 15:40:13 +00:00
|
|
|
queue->sinktime = queue->srctime = GST_CLOCK_TIME_NONE;
|
|
|
|
queue->sink_tainted = queue->src_tainted = TRUE;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
if (queue->starting_segment != NULL)
|
|
|
|
gst_event_unref (queue->starting_segment);
|
|
|
|
queue->starting_segment = NULL;
|
|
|
|
queue->segment_event_received = FALSE;
|
2012-01-27 11:33:32 +00:00
|
|
|
gst_event_replace (&queue->stream_start_event, NULL);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* we deleted a lot of something */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-06-15 10:37:33 +00:00
|
|
|
static gboolean
|
|
|
|
gst_queue2_wait_free_space (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
/* We make space available if we're "full" according to whatever
|
|
|
|
* the user defined as "full". */
|
|
|
|
if (gst_queue2_is_filled (queue)) {
|
|
|
|
gboolean started;
|
|
|
|
|
|
|
|
/* pause the timer while we wait. The fact that we are waiting does not mean
|
|
|
|
* the byterate on the input pad is lower */
|
|
|
|
if ((started = queue->in_timer_started))
|
|
|
|
g_timer_stop (queue->in_timer);
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
|
|
|
"queue is full, waiting for free space");
|
|
|
|
do {
|
|
|
|
/* Wait for space to be available, we could be unlocked because of a flush. */
|
|
|
|
GST_QUEUE2_WAIT_DEL_CHECK (queue, queue->sinkresult, out_flushing);
|
|
|
|
}
|
|
|
|
while (gst_queue2_is_filled (queue));
|
|
|
|
|
|
|
|
/* and continue if we were running before */
|
|
|
|
if (started)
|
|
|
|
g_timer_continue (queue->in_timer);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is flushing");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
static gboolean
|
2010-06-18 15:43:40 +00:00
|
|
|
gst_queue2_create_write (GstQueue2 * queue, GstBuffer * buffer)
|
2010-05-07 07:30:44 +00:00
|
|
|
{
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *data, *ring_buffer;
|
2010-06-16 16:25:35 +00:00
|
|
|
guint size, rb_size;
|
2010-10-31 17:48:19 +00:00
|
|
|
guint64 writing_pos, new_writing_pos;
|
2010-06-18 12:36:33 +00:00
|
|
|
GstQueue2Range *range, *prev, *next;
|
2014-02-18 13:21:20 +00:00
|
|
|
gboolean do_seek = FALSE;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
|
|
|
writing_pos = queue->current->rb_writing_pos;
|
|
|
|
else
|
|
|
|
writing_pos = queue->current->writing_pos;
|
2010-06-18 15:43:40 +00:00
|
|
|
ring_buffer = queue->ring_buffer;
|
2010-06-16 15:03:49 +00:00
|
|
|
rb_size = queue->ring_buffer_max_size;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2014-04-16 09:39:15 +00:00
|
|
|
if (!gst_buffer_map (buffer, &info, GST_MAP_READ))
|
|
|
|
goto buffer_read_error;
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
size = info.size;
|
|
|
|
data = info.data;
|
2010-06-15 14:12:02 +00:00
|
|
|
|
2010-07-02 15:40:08 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "Writing %u bytes to %" G_GUINT64_FORMAT, size,
|
2012-04-11 09:55:56 +00:00
|
|
|
writing_pos);
|
2010-07-02 15:40:08 +00:00
|
|
|
|
2012-05-24 12:08:16 +00:00
|
|
|
/* sanity check */
|
|
|
|
if (GST_BUFFER_OFFSET_IS_VALID (buffer) &&
|
|
|
|
GST_BUFFER_OFFSET (buffer) != queue->current->writing_pos) {
|
|
|
|
GST_WARNING_OBJECT (queue, "buffer offset does not match current writing "
|
|
|
|
"position! %" G_GINT64_FORMAT " != %" G_GINT64_FORMAT,
|
|
|
|
GST_BUFFER_OFFSET (buffer), queue->current->writing_pos);
|
|
|
|
}
|
|
|
|
|
2010-06-16 16:25:35 +00:00
|
|
|
while (size > 0) {
|
|
|
|
guint to_write;
|
2010-06-06 07:30:48 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
2010-10-31 17:46:43 +00:00
|
|
|
gint64 space;
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
/* calculate the space in the ring buffer not used by data from
|
|
|
|
* the current range */
|
|
|
|
while (QUEUE_MAX_BYTES (queue) <= queue->cur_level.bytes) {
|
|
|
|
/* wait until there is some free space */
|
|
|
|
GST_QUEUE2_WAIT_DEL_CHECK (queue, queue->sinkresult, out_flushing);
|
|
|
|
}
|
|
|
|
/* get the amount of space we have */
|
|
|
|
space = QUEUE_MAX_BYTES (queue) - queue->cur_level.bytes;
|
|
|
|
|
|
|
|
/* calculate if we need to split or if we can write the entire
|
|
|
|
* buffer now */
|
|
|
|
to_write = MIN (size, space);
|
|
|
|
|
|
|
|
/* the writing position in the ring buffer after writing (part
|
|
|
|
* or all of) the buffer */
|
|
|
|
new_writing_pos = (writing_pos + to_write) % rb_size;
|
|
|
|
|
|
|
|
prev = NULL;
|
|
|
|
range = queue->ranges;
|
|
|
|
|
|
|
|
/* if we need to overwrite data in the ring buffer, we need to
|
|
|
|
* update the ranges
|
|
|
|
*
|
|
|
|
* warning: this code is complicated and includes some
|
|
|
|
* simplifications - pen, paper and diagrams for the cases
|
|
|
|
* recommended! */
|
|
|
|
while (range) {
|
|
|
|
guint64 range_data_start, range_data_end;
|
|
|
|
GstQueue2Range *range_to_destroy = NULL;
|
|
|
|
|
2016-06-15 12:43:59 +00:00
|
|
|
if (range == queue->current)
|
|
|
|
goto next_range;
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
range_data_start = range->rb_offset;
|
|
|
|
range_data_end = range->rb_writing_pos;
|
|
|
|
|
2010-07-07 06:20:21 +00:00
|
|
|
/* handle the special case where the range has no data in it */
|
|
|
|
if (range->writing_pos == range->offset) {
|
|
|
|
if (range != queue->current) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Removing range: offset %" G_GUINT64_FORMAT ", wpos %"
|
|
|
|
G_GUINT64_FORMAT, range->offset, range->writing_pos);
|
|
|
|
/* remove range */
|
|
|
|
range_to_destroy = range;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range->next;
|
|
|
|
}
|
|
|
|
goto next_range;
|
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (range_data_end > range_data_start) {
|
|
|
|
if (writing_pos >= range_data_end && new_writing_pos >= writing_pos)
|
|
|
|
goto next_range;
|
|
|
|
|
|
|
|
if (new_writing_pos > range_data_start) {
|
|
|
|
if (new_writing_pos >= range_data_end) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Removing range: offset %" G_GUINT64_FORMAT ", wpos %"
|
|
|
|
G_GUINT64_FORMAT, range->offset, range->writing_pos);
|
|
|
|
/* remove range */
|
|
|
|
range_to_destroy = range;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range->next;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"advancing offsets from %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ") to %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ")", range->offset, range->rb_offset,
|
|
|
|
range->offset + new_writing_pos - range_data_start,
|
|
|
|
new_writing_pos);
|
|
|
|
range->offset += (new_writing_pos - range_data_start);
|
|
|
|
range->rb_offset = new_writing_pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
guint64 new_wpos_virt = writing_pos + to_write;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (new_wpos_virt <= range_data_start)
|
|
|
|
goto next_range;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (new_wpos_virt > rb_size && new_writing_pos >= range_data_end) {
|
2010-05-19 14:04:15 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Removing range: offset %" G_GUINT64_FORMAT ", wpos %"
|
|
|
|
G_GUINT64_FORMAT, range->offset, range->writing_pos);
|
2010-05-07 07:30:44 +00:00
|
|
|
/* remove range */
|
|
|
|
range_to_destroy = range;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range->next;
|
|
|
|
} else {
|
2010-05-19 14:04:15 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"advancing offsets from %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ") to %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ")", range->offset, range->rb_offset,
|
|
|
|
range->offset + new_writing_pos - range_data_start,
|
|
|
|
new_writing_pos);
|
2010-06-18 12:36:33 +00:00
|
|
|
range->offset += (new_wpos_virt - range_data_start);
|
2010-05-07 07:30:44 +00:00
|
|
|
range->rb_offset = new_writing_pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
next_range:
|
|
|
|
if (!range_to_destroy)
|
|
|
|
prev = range;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
range = range->next;
|
|
|
|
if (range_to_destroy) {
|
|
|
|
if (range_to_destroy == queue->ranges)
|
|
|
|
queue->ranges = range;
|
|
|
|
g_slice_free (GstQueue2Range, range_to_destroy);
|
|
|
|
range_to_destroy = NULL;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 12:36:33 +00:00
|
|
|
} else {
|
2010-10-31 17:46:43 +00:00
|
|
|
to_write = size;
|
2010-06-18 12:36:33 +00:00
|
|
|
new_writing_pos = writing_pos + to_write;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)
|
|
|
|
&& FSEEK_FILE (queue->temp_file, writing_pos))
|
2010-06-15 10:37:33 +00:00
|
|
|
goto seek_failed;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
|
|
|
if (new_writing_pos > writing_pos) {
|
2010-07-02 15:40:08 +00:00
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"writing %u bytes to range [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT
|
|
|
|
"] (rb wpos %" G_GUINT64_FORMAT ")", to_write, queue->current->offset,
|
|
|
|
queue->current->writing_pos, queue->current->rb_writing_pos);
|
2010-06-18 12:36:33 +00:00
|
|
|
/* either not using ring buffer or no wrapping, just write */
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (fwrite (data, to_write, 1, queue->temp_file) != 1)
|
|
|
|
goto handle_error;
|
|
|
|
} else {
|
|
|
|
memcpy (ring_buffer + writing_pos, data, to_write);
|
|
|
|
}
|
2010-06-18 12:36:33 +00:00
|
|
|
|
|
|
|
if (!QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
/* try to merge with next range */
|
|
|
|
while ((next = queue->current->next)) {
|
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"checking merge with next range %" G_GUINT64_FORMAT " < %"
|
|
|
|
G_GUINT64_FORMAT, new_writing_pos, next->offset);
|
|
|
|
if (new_writing_pos < next->offset)
|
|
|
|
break;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "merging ranges %" G_GUINT64_FORMAT,
|
|
|
|
next->writing_pos);
|
|
|
|
|
2014-02-18 13:21:20 +00:00
|
|
|
/* remove the group */
|
2010-06-18 12:36:33 +00:00
|
|
|
queue->current->next = next->next;
|
|
|
|
|
2014-02-18 13:21:20 +00:00
|
|
|
/* We use the threshold to decide if we want to do a seek or simply
|
|
|
|
* read the data again. If there is not so much data in the range we
|
|
|
|
* prefer to avoid to seek and read it again. */
|
|
|
|
if (next->writing_pos > new_writing_pos + get_seek_threshold (queue)) {
|
|
|
|
/* the new range had more data than the threshold, it's worth keeping
|
|
|
|
* it and doing a seek. */
|
|
|
|
new_writing_pos = next->writing_pos;
|
|
|
|
do_seek = TRUE;
|
|
|
|
}
|
|
|
|
g_slice_free (GstQueue2Range, next);
|
2010-06-18 12:36:33 +00:00
|
|
|
}
|
|
|
|
goto update_and_signal;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
} else {
|
|
|
|
/* wrapping */
|
|
|
|
guint block_one, block_two;
|
|
|
|
|
|
|
|
block_one = rb_size - writing_pos;
|
2010-06-16 16:25:35 +00:00
|
|
|
block_two = to_write - block_one;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-15 15:26:15 +00:00
|
|
|
if (block_one > 0) {
|
|
|
|
GST_INFO_OBJECT (queue, "writing %u bytes", block_one);
|
|
|
|
/* write data to end of ring buffer */
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (fwrite (data, block_one, 1, queue->temp_file) != 1)
|
|
|
|
goto handle_error;
|
|
|
|
} else {
|
|
|
|
memcpy (ring_buffer + writing_pos, data, block_one);
|
|
|
|
}
|
2010-06-15 15:26:15 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue) && FSEEK_FILE (queue->temp_file, 0))
|
2010-06-15 10:37:33 +00:00
|
|
|
goto seek_failed;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-15 15:26:15 +00:00
|
|
|
if (block_two > 0) {
|
|
|
|
GST_INFO_OBJECT (queue, "writing %u bytes", block_two);
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (fwrite (data + block_one, block_two, 1, queue->temp_file) != 1)
|
|
|
|
goto handle_error;
|
|
|
|
} else {
|
|
|
|
memcpy (ring_buffer, data + block_one, block_two);
|
|
|
|
}
|
2010-06-15 15:26:15 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
update_and_signal:
|
2010-05-07 07:30:44 +00:00
|
|
|
/* update the writing positions */
|
2010-06-16 16:25:35 +00:00
|
|
|
size -= to_write;
|
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"wrote %u bytes to %" G_GUINT64_FORMAT " (%u bytes remaining to write)",
|
|
|
|
to_write, writing_pos, size);
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
data += to_write;
|
|
|
|
queue->current->writing_pos += to_write;
|
|
|
|
queue->current->rb_writing_pos = writing_pos = new_writing_pos;
|
|
|
|
} else {
|
|
|
|
queue->current->writing_pos = writing_pos = new_writing_pos;
|
|
|
|
}
|
2014-02-18 13:21:20 +00:00
|
|
|
if (do_seek)
|
|
|
|
perform_seek_to_offset (queue, new_writing_pos);
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
update_cur_level (queue, queue->current);
|
|
|
|
|
2010-06-25 10:58:27 +00:00
|
|
|
/* update the buffering status */
|
2016-08-12 14:15:25 +00:00
|
|
|
if (queue->use_buffering) {
|
|
|
|
GstMessage *msg;
|
2020-06-04 09:21:45 +00:00
|
|
|
gint percent = -1;
|
2010-10-19 16:09:53 +00:00
|
|
|
update_buffering (queue);
|
2020-06-04 09:21:45 +00:00
|
|
|
msg = gst_queue2_get_buffering_message (queue, &percent);
|
2016-08-12 14:15:25 +00:00
|
|
|
if (msg) {
|
2019-10-04 14:57:29 +00:00
|
|
|
gboolean post_ok;
|
|
|
|
|
2016-08-12 14:15:25 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2019-10-04 14:57:29 +00:00
|
|
|
|
2016-08-12 14:15:25 +00:00
|
|
|
g_mutex_lock (&queue->buffering_post_lock);
|
2019-10-04 14:57:29 +00:00
|
|
|
post_ok = gst_element_post_message (GST_ELEMENT_CAST (queue), msg);
|
|
|
|
|
2016-08-12 14:15:25 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2019-10-04 14:57:29 +00:00
|
|
|
|
|
|
|
if (post_ok) {
|
|
|
|
/* Set these states only if posting the message succeeded. Otherwise,
|
|
|
|
* this post attempt failed, and the next one won't be done, because
|
|
|
|
* gst_queue2_get_buffering_message() checks these states and decides
|
|
|
|
* based on their values that it won't produce a message. */
|
2020-06-04 09:21:45 +00:00
|
|
|
queue->last_posted_buffering_percent = percent;
|
|
|
|
if (percent == queue->buffering_percent)
|
|
|
|
queue->percent_changed = FALSE;
|
|
|
|
GST_DEBUG_OBJECT (queue, "successfully posted %d%% buffering message",
|
|
|
|
percent);
|
2020-05-20 15:32:48 +00:00
|
|
|
} else {
|
2019-10-04 14:57:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "could not post buffering message");
|
2020-05-20 15:32:48 +00:00
|
|
|
}
|
|
|
|
g_mutex_unlock (&queue->buffering_post_lock);
|
2016-08-12 14:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-25 10:58:27 +00:00
|
|
|
|
2010-08-19 07:58:55 +00:00
|
|
|
GST_INFO_OBJECT (queue, "cur_level.bytes %u (max %" G_GUINT64_FORMAT ")",
|
2010-06-16 15:03:49 +00:00
|
|
|
queue->cur_level.bytes, QUEUE_MAX_BYTES (queue));
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2011-03-21 17:13:55 +00:00
|
|
|
}
|
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
2010-05-07 07:30:44 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "we are flushing");
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
2011-10-10 09:33:51 +00:00
|
|
|
/* FIXME - GST_FLOW_EOS ? */
|
2010-05-07 07:30:44 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2010-06-15 10:37:33 +00:00
|
|
|
seek_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, SEEK, (NULL), GST_ERROR_SYSTEM);
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
2010-06-15 10:37:33 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
handle_error:
|
|
|
|
{
|
|
|
|
switch (errno) {
|
|
|
|
case ENOSPC:{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, NO_SPACE_LEFT, (NULL), (NULL));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, WRITE,
|
|
|
|
(_("Error while writing to download file.")),
|
|
|
|
("%s", g_strerror (errno)));
|
|
|
|
}
|
|
|
|
}
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
2010-05-07 07:30:44 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2014-04-16 09:39:15 +00:00
|
|
|
buffer_read_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, READ, (NULL),
|
|
|
|
("Can't read from buffer"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2011-11-28 01:00:28 +00:00
|
|
|
static gboolean
|
|
|
|
buffer_list_create_write (GstBuffer ** buf, guint idx, gpointer q)
|
2011-11-03 10:34:49 +00:00
|
|
|
{
|
|
|
|
GstQueue2 *queue = q;
|
|
|
|
|
2011-11-28 01:00:28 +00:00
|
|
|
GST_TRACE_OBJECT (queue,
|
|
|
|
"writing buffer %u of size %" G_GSIZE_FORMAT " bytes", idx,
|
|
|
|
gst_buffer_get_size (*buf));
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
if (!gst_queue2_create_write (queue, *buf)) {
|
|
|
|
GST_INFO_OBJECT (queue, "create_write() returned FALSE, bailing out");
|
2011-11-28 01:00:28 +00:00
|
|
|
return FALSE;
|
2011-11-03 10:34:49 +00:00
|
|
|
}
|
2011-11-28 01:00:28 +00:00
|
|
|
return TRUE;
|
2011-11-03 10:34:49 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* enqueue an item an update the level stats */
|
|
|
|
static void
|
2011-11-03 08:55:20 +00:00
|
|
|
gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item,
|
|
|
|
GstQueue2ItemType item_type)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2011-11-03 08:55:20 +00:00
|
|
|
if (item_type == GST_QUEUE2_ITEM_TYPE_BUFFER) {
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
guint size;
|
|
|
|
|
|
|
|
buffer = GST_BUFFER_CAST (item);
|
2011-03-21 17:13:55 +00:00
|
|
|
size = gst_buffer_get_size (buffer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* add buffer to the statistics */
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-25 16:21:02 +00:00
|
|
|
queue->cur_level.buffers++;
|
|
|
|
queue->cur_level.bytes += size;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->bytes_in += size;
|
2009-07-14 15:03:35 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* apply new buffer to segment stats */
|
2015-11-11 14:14:34 +00:00
|
|
|
apply_buffer (queue, buffer, &queue->sink_segment, size, TRUE);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* update the byterate stats */
|
2016-07-11 07:58:47 +00:00
|
|
|
update_in_rates (queue, FALSE);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-06-25 10:58:27 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
/* FIXME - check return value? */
|
|
|
|
gst_queue2_create_write (queue, buffer);
|
|
|
|
}
|
2011-11-03 10:34:49 +00:00
|
|
|
} else if (item_type == GST_QUEUE2_ITEM_TYPE_BUFFER_LIST) {
|
|
|
|
GstBufferList *buffer_list;
|
2017-08-31 12:05:57 +00:00
|
|
|
guint size;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
buffer_list = GST_BUFFER_LIST_CAST (item);
|
|
|
|
|
2017-08-31 12:05:57 +00:00
|
|
|
size = gst_buffer_list_calculate_size (buffer_list);
|
2011-11-03 10:34:49 +00:00
|
|
|
GST_LOG_OBJECT (queue, "total size of buffer list: %u bytes", size);
|
|
|
|
|
|
|
|
/* add buffer to the statistics */
|
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2015-02-17 09:41:50 +00:00
|
|
|
queue->cur_level.buffers += gst_buffer_list_length (buffer_list);
|
2011-11-03 10:34:49 +00:00
|
|
|
queue->cur_level.bytes += size;
|
|
|
|
}
|
|
|
|
queue->bytes_in += size;
|
|
|
|
|
|
|
|
/* apply new buffer to segment stats */
|
|
|
|
apply_buffer_list (queue, buffer_list, &queue->sink_segment, TRUE);
|
|
|
|
|
|
|
|
/* update the byterate stats */
|
2016-07-11 07:58:47 +00:00
|
|
|
update_in_rates (queue, FALSE);
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
gst_buffer_list_foreach (buffer_list, buffer_list_create_write, queue);
|
|
|
|
}
|
2011-11-03 08:55:20 +00:00
|
|
|
} else if (item_type == GST_QUEUE2_ITEM_TYPE_EVENT) {
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstEvent *event;
|
|
|
|
|
|
|
|
event = GST_EVENT_CAST (item);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* Zero the thresholds, this makes sure the queue is completely
|
|
|
|
* filled and we can read all data from the queue. */
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "we have EOS");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->is_eos = TRUE;
|
2016-07-11 07:58:47 +00:00
|
|
|
/* Force updating the input bitrate */
|
|
|
|
update_in_rates (queue, TRUE);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2011-05-13 16:07:24 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2010-10-19 15:40:13 +00:00
|
|
|
apply_segment (queue, event, &queue->sink_segment, TRUE);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* This is our first new segment, we hold it
|
|
|
|
* as we can't save it on the temp file */
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
if (queue->segment_event_received)
|
|
|
|
goto unexpected_event;
|
|
|
|
|
|
|
|
queue->segment_event_received = TRUE;
|
2009-07-14 15:03:35 +00:00
|
|
|
if (queue->starting_segment != NULL)
|
|
|
|
gst_event_unref (queue->starting_segment);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
queue->starting_segment = event;
|
2009-07-14 15:03:35 +00:00
|
|
|
item = NULL;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
2011-10-10 09:33:51 +00:00
|
|
|
/* a new segment allows us to accept more buffers if we got EOS
|
2007-09-17 16:22:17 +00:00
|
|
|
* from downstream */
|
|
|
|
queue->unexpected = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2014-10-02 07:57:43 +00:00
|
|
|
case GST_EVENT_GAP:
|
|
|
|
apply_gap (queue, event, &queue->sink_segment, TRUE);
|
|
|
|
break;
|
2012-01-27 11:33:32 +00:00
|
|
|
case GST_EVENT_STREAM_START:
|
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
gst_event_replace (&queue->stream_start_event, event);
|
|
|
|
gst_event_unref (event);
|
|
|
|
item = NULL;
|
|
|
|
}
|
|
|
|
break;
|
2012-07-17 18:20:23 +00:00
|
|
|
case GST_EVENT_CAPS:{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
GST_LOG ("Dropping caps event, not using queue");
|
|
|
|
gst_event_unref (event);
|
|
|
|
item = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue))
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
goto unexpected_event;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-05-24 17:22:22 +00:00
|
|
|
} else if (GST_IS_QUERY (item)) {
|
|
|
|
/* Can't happen as we check that in the caller */
|
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue))
|
|
|
|
g_assert_not_reached ();
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
|
|
|
g_warning ("Unexpected item %p added in queue %s (refcounting problem?)",
|
|
|
|
item, GST_OBJECT_NAME (queue));
|
|
|
|
/* we can't really unref since we don't know what it is */
|
|
|
|
item = NULL;
|
|
|
|
}
|
|
|
|
|
2007-06-12 08:38:06 +00:00
|
|
|
if (item) {
|
2010-09-15 11:15:19 +00:00
|
|
|
/* update the buffering status */
|
2010-10-19 16:09:53 +00:00
|
|
|
if (queue->use_buffering)
|
|
|
|
update_buffering (queue);
|
2007-06-12 08:38:06 +00:00
|
|
|
|
2010-09-15 11:15:19 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2018-06-02 12:02:19 +00:00
|
|
|
GstQueue2Item qitem;
|
|
|
|
|
|
|
|
qitem.type = item_type;
|
|
|
|
qitem.item = item;
|
|
|
|
gst_queue_array_push_tail_struct (queue->queue, &qitem);
|
2010-06-25 10:58:27 +00:00
|
|
|
} else {
|
2009-07-14 15:03:35 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (item));
|
2010-06-25 10:58:27 +00:00
|
|
|
}
|
2009-07-14 15:03:35 +00:00
|
|
|
|
2010-07-02 15:40:08 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2007-06-12 08:38:06 +00:00
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
unexpected_event:
|
|
|
|
{
|
2015-11-18 11:46:45 +00:00
|
|
|
gboolean is_custom = GST_EVENT_TYPE (item) < GST_EVENT_CUSTOM_UPSTREAM;
|
|
|
|
|
|
|
|
GST_WARNING_OBJECT (queue, "%s%s event can't be added to temp file: "
|
|
|
|
"%" GST_PTR_FORMAT, is_custom ? "Unexpected " : "",
|
|
|
|
GST_EVENT_TYPE_NAME (item), GST_EVENT_CAST (item));
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
gst_event_unref (GST_EVENT_CAST (item));
|
|
|
|
return;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dequeue an item from the queue and update level stats */
|
|
|
|
static GstMiniObject *
|
2011-11-03 08:55:20 +00:00
|
|
|
gst_queue2_locked_dequeue (GstQueue2 * queue, GstQueue2ItemType * item_type)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GstMiniObject *item;
|
|
|
|
|
2013-05-27 13:41:14 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2009-10-29 10:30:11 +00:00
|
|
|
item = gst_queue2_read_item_from_file (queue);
|
2013-05-27 13:41:14 +00:00
|
|
|
} else {
|
2018-06-02 12:02:19 +00:00
|
|
|
GstQueue2Item *qitem = gst_queue_array_pop_head_struct (queue->queue);
|
2013-08-16 15:45:41 +00:00
|
|
|
|
|
|
|
if (qitem == NULL)
|
|
|
|
goto no_item;
|
|
|
|
|
2013-05-27 13:41:14 +00:00
|
|
|
item = qitem->item;
|
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (item == NULL)
|
|
|
|
goto no_item;
|
|
|
|
|
|
|
|
if (GST_IS_BUFFER (item)) {
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint size;
|
|
|
|
|
|
|
|
buffer = GST_BUFFER_CAST (item);
|
2011-03-21 17:13:55 +00:00
|
|
|
size = gst_buffer_get_size (buffer);
|
2011-11-03 08:55:20 +00:00
|
|
|
*item_type = GST_QUEUE2_ITEM_TYPE_BUFFER;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"retrieved buffer %p from queue", buffer);
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-25 16:21:02 +00:00
|
|
|
queue->cur_level.buffers--;
|
|
|
|
queue->cur_level.bytes -= size;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->bytes_out += size;
|
2010-03-25 16:21:02 +00:00
|
|
|
|
2015-11-11 14:14:34 +00:00
|
|
|
apply_buffer (queue, buffer, &queue->src_segment, size, FALSE);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* update the byterate stats */
|
2007-12-14 18:46:12 +00:00
|
|
|
update_out_rates (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* update the buffering */
|
2010-10-19 16:09:53 +00:00
|
|
|
if (queue->use_buffering)
|
|
|
|
update_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
} else if (GST_IS_EVENT (item)) {
|
|
|
|
GstEvent *event = GST_EVENT_CAST (item);
|
|
|
|
|
2011-11-03 08:55:20 +00:00
|
|
|
*item_type = GST_QUEUE2_ITEM_TYPE_EVENT;
|
2011-02-02 14:35:45 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"retrieved event %p from queue", event);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* queue is empty now that we dequeued the EOS */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2011-05-13 16:07:24 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2010-10-19 15:40:13 +00:00
|
|
|
apply_segment (queue, event, &queue->src_segment, FALSE);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2014-10-02 07:57:43 +00:00
|
|
|
case GST_EVENT_GAP:
|
|
|
|
apply_gap (queue, event, &queue->src_segment, FALSE);
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-11-03 10:34:49 +00:00
|
|
|
} else if (GST_IS_BUFFER_LIST (item)) {
|
|
|
|
GstBufferList *buffer_list;
|
2017-08-31 12:05:57 +00:00
|
|
|
guint size;
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
buffer_list = GST_BUFFER_LIST_CAST (item);
|
2017-08-31 12:05:57 +00:00
|
|
|
size = gst_buffer_list_calculate_size (buffer_list);
|
2011-11-03 10:34:49 +00:00
|
|
|
*item_type = GST_QUEUE2_ITEM_TYPE_BUFFER_LIST;
|
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"retrieved buffer list %p from queue", buffer_list);
|
|
|
|
|
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2015-02-17 09:41:50 +00:00
|
|
|
queue->cur_level.buffers -= gst_buffer_list_length (buffer_list);
|
2011-11-03 10:34:49 +00:00
|
|
|
queue->cur_level.bytes -= size;
|
|
|
|
}
|
|
|
|
queue->bytes_out += size;
|
|
|
|
|
|
|
|
apply_buffer_list (queue, buffer_list, &queue->src_segment, FALSE);
|
|
|
|
/* update the byterate stats */
|
|
|
|
update_out_rates (queue);
|
|
|
|
/* update the buffering */
|
|
|
|
if (queue->use_buffering)
|
|
|
|
update_buffering (queue);
|
2013-05-24 17:22:22 +00:00
|
|
|
} else if (GST_IS_QUERY (item)) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"retrieved query %p from queue", item);
|
|
|
|
*item_type = GST_QUEUE2_ITEM_TYPE_QUERY;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
|
|
|
g_warning
|
|
|
|
("Unexpected item %p dequeued from queue %s (refcounting problem?)",
|
|
|
|
item, GST_OBJECT_NAME (queue));
|
|
|
|
item = NULL;
|
2011-11-03 08:55:20 +00:00
|
|
|
*item_type = GST_QUEUE2_ITEM_TYPE_UNKNOWN;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2010-06-15 14:12:02 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return item;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_item:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "the queue is empty");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-08 11:54:42 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_queue2_handle_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2013-12-11 13:42:34 +00:00
|
|
|
gboolean ret = TRUE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2017-08-09 14:15:23 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "Received event '%s'",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
{
|
2012-04-06 10:42:39 +00:00
|
|
|
if (GST_PAD_MODE (queue->srcpad) == GST_PAD_MODE_PUSH) {
|
2010-03-23 18:25:29 +00:00
|
|
|
/* forward event */
|
2013-12-11 13:42:34 +00:00
|
|
|
ret = gst_pad_push_event (queue->srcpad, event);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* now unblock the chain function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
2010-03-23 18:25:29 +00:00
|
|
|
/* unblock the loop and chain functions */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* make sure it pauses, this should happen since we sent
|
|
|
|
* flush_start downstream. */
|
|
|
|
gst_pad_pause_task (queue->srcpad);
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "loop stopped");
|
2016-03-11 14:04:52 +00:00
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->last_query = FALSE;
|
|
|
|
g_cond_signal (&queue->query_handled);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2010-06-16 09:10:23 +00:00
|
|
|
} else {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
/* flush the sink pad */
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
2010-06-16 09:10:23 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
2013-05-27 13:41:14 +00:00
|
|
|
queue->last_query = FALSE;
|
|
|
|
g_cond_signal (&queue->query_handled);
|
2010-06-16 09:10:23 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
2013-12-11 13:42:34 +00:00
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
{
|
2012-04-06 10:42:39 +00:00
|
|
|
if (GST_PAD_MODE (queue->srcpad) == GST_PAD_MODE_PUSH) {
|
2010-03-23 18:25:29 +00:00
|
|
|
/* forward event */
|
2013-12-11 13:42:34 +00:00
|
|
|
ret = gst_pad_push_event (queue->srcpad, event);
|
2010-03-23 18:25:29 +00:00
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2014-02-18 14:46:32 +00:00
|
|
|
gst_queue2_locked_flush (queue, FALSE, TRUE);
|
2010-03-23 18:25:29 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2010-03-23 18:25:29 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2012-04-10 09:20:09 +00:00
|
|
|
queue->seeking = FALSE;
|
2015-11-11 14:14:34 +00:00
|
|
|
queue->src_tags_bitrate = queue->sink_tags_bitrate = 0;
|
2010-03-23 18:25:29 +00:00
|
|
|
/* reset rate counters */
|
|
|
|
reset_rate_timer (queue);
|
|
|
|
gst_pad_start_task (queue->srcpad, (GstTaskFunction) gst_queue2_loop,
|
2012-06-20 08:31:49 +00:00
|
|
|
queue->srcpad, NULL);
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
} else {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->segment_event_received = FALSE;
|
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2010-06-16 09:10:23 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2012-04-10 14:04:54 +00:00
|
|
|
queue->seeking = FALSE;
|
2015-11-11 14:14:34 +00:00
|
|
|
queue->src_tags_bitrate = queue->sink_tags_bitrate = 0;
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2010-06-16 09:10:23 +00:00
|
|
|
|
|
|
|
gst_event_unref (event);
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
2019-10-31 10:06:48 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (queue), obj_props[PROP_BITRATE]);
|
2013-12-11 13:42:34 +00:00
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2015-11-11 14:14:34 +00:00
|
|
|
case GST_EVENT_TAG:{
|
|
|
|
if (queue->use_tags_bitrate) {
|
|
|
|
GstTagList *tags;
|
|
|
|
guint bitrate;
|
|
|
|
|
|
|
|
gst_event_parse_tag (event, &tags);
|
|
|
|
if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &bitrate) ||
|
|
|
|
gst_tag_list_get_uint (tags, GST_TAG_NOMINAL_BITRATE, &bitrate)) {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->sink_tags_bitrate = bitrate;
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
GST_LOG_OBJECT (queue, "Sink pad bitrate from tags now %u", bitrate);
|
2019-10-31 10:06:48 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (queue), obj_props[PROP_BITRATE]);
|
2015-11-11 14:14:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Fall-through */
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
if (GST_EVENT_IS_SERIALIZED (event)) {
|
2018-05-17 11:42:43 +00:00
|
|
|
gboolean bitrate_changed = TRUE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* serialized events go in the queue */
|
2017-08-09 14:15:23 +00:00
|
|
|
|
|
|
|
/* STREAM_START and SEGMENT reset the EOS status of a
|
|
|
|
* pad. Change the cached sinkpad flow result accordingly */
|
|
|
|
if (queue->sinkresult == GST_FLOW_EOS
|
|
|
|
&& (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START
|
|
|
|
|| GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT))
|
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing);
|
2014-08-13 09:20:51 +00:00
|
|
|
if (queue->srcresult != GST_FLOW_OK) {
|
|
|
|
/* Errors in sticky event pushing are no problem and ignored here
|
|
|
|
* as they will cause more meaningful errors during data flow.
|
|
|
|
* For EOS events, that are not followed by data flow, we still
|
|
|
|
* return FALSE here though and report an error.
|
|
|
|
*/
|
|
|
|
if (!GST_EVENT_IS_STICKY (event)) {
|
|
|
|
goto out_flow_error;
|
|
|
|
} else if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
|
|
|
if (queue->srcresult == GST_FLOW_NOT_LINKED
|
|
|
|
|| queue->srcresult < GST_FLOW_EOS) {
|
2016-08-23 16:27:58 +00:00
|
|
|
GST_ELEMENT_FLOW_ERROR (queue, queue->srcresult);
|
2014-08-13 09:20:51 +00:00
|
|
|
}
|
|
|
|
goto out_flow_error;
|
|
|
|
}
|
|
|
|
}
|
2017-08-09 14:15:23 +00:00
|
|
|
|
|
|
|
/* refuse more events on EOS unless they unset the EOS status */
|
|
|
|
if (queue->is_eos) {
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_STREAM_START:
|
|
|
|
case GST_EVENT_SEGMENT:
|
|
|
|
/* Restart the loop */
|
|
|
|
if (GST_PAD_MODE (queue->srcpad) == GST_PAD_MODE_PUSH) {
|
|
|
|
queue->srcresult = GST_FLOW_OK;
|
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
|
|
|
queue->seeking = FALSE;
|
|
|
|
queue->src_tags_bitrate = queue->sink_tags_bitrate = 0;
|
|
|
|
/* reset rate counters */
|
|
|
|
reset_rate_timer (queue);
|
|
|
|
gst_pad_start_task (queue->srcpad,
|
|
|
|
(GstTaskFunction) gst_queue2_loop, queue->srcpad, NULL);
|
|
|
|
} else {
|
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
|
|
|
queue->seeking = FALSE;
|
|
|
|
queue->src_tags_bitrate = queue->sink_tags_bitrate = 0;
|
|
|
|
}
|
2018-05-17 11:42:43 +00:00
|
|
|
bitrate_changed = TRUE;
|
2017-08-09 14:15:23 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto out_eos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-03 08:55:20 +00:00
|
|
|
gst_queue2_locked_enqueue (queue, event, GST_QUEUE2_ITEM_TYPE_EVENT);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
2018-05-17 11:42:43 +00:00
|
|
|
if (bitrate_changed)
|
2019-10-31 10:06:48 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (queue), obj_props[PROP_BITRATE]);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
2017-01-22 14:26:56 +00:00
|
|
|
/* non-serialized events are passed downstream. */
|
2013-12-11 13:42:34 +00:00
|
|
|
ret = gst_pad_push_event (queue->srcpad, event);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-10-08 11:54:42 +00:00
|
|
|
if (ret == FALSE)
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
return GST_FLOW_OK;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2017-01-22 14:26:56 +00:00
|
|
|
GstFlowReturn ret = queue->sinkresult;
|
|
|
|
GST_DEBUG_OBJECT (queue, "refusing event, we are %s",
|
|
|
|
gst_flow_get_name (ret));
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-09-17 16:22:17 +00:00
|
|
|
gst_event_unref (event);
|
2017-01-22 14:26:56 +00:00
|
|
|
return ret;
|
2007-09-17 16:22:17 +00:00
|
|
|
}
|
|
|
|
out_eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "refusing event, we are EOS");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-09-17 16:22:17 +00:00
|
|
|
gst_event_unref (event);
|
2016-10-08 11:54:42 +00:00
|
|
|
return GST_FLOW_EOS;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2014-08-13 09:20:51 +00:00
|
|
|
out_flow_error:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (queue,
|
|
|
|
"refusing event, we have a downstream flow error: %s",
|
|
|
|
gst_flow_get_name (queue->srcresult));
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
gst_event_unref (event);
|
2016-10-08 11:54:42 +00:00
|
|
|
return queue->srcresult;
|
2014-08-13 09:20:51 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2011-11-09 16:36:00 +00:00
|
|
|
static gboolean
|
2011-11-16 16:22:56 +00:00
|
|
|
gst_queue2_handle_sink_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query)
|
2011-11-09 16:36:00 +00:00
|
|
|
{
|
2013-05-24 17:22:22 +00:00
|
|
|
GstQueue2 *queue;
|
2011-11-09 16:36:00 +00:00
|
|
|
gboolean res;
|
|
|
|
|
2013-05-24 17:22:22 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
|
|
|
|
2011-11-09 16:36:00 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
default:
|
2012-03-14 14:42:47 +00:00
|
|
|
if (GST_QUERY_IS_SERIALIZED (query)) {
|
2018-09-25 07:03:03 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"received query %" GST_PTR_FORMAT, query);
|
2013-06-24 21:25:51 +00:00
|
|
|
/* serialized events go in the queue. We need to be certain that we
|
|
|
|
* don't cause deadlocks waiting for the query return value. We check if
|
|
|
|
* the queue is empty (nothing is blocking downstream and the query can
|
|
|
|
* be pushed for sure) or we are not buffering. If we are buffering,
|
|
|
|
* the pipeline waits to unblock downstream until our queue fills up
|
|
|
|
* completely, which can not happen if we block on the query..
|
|
|
|
* Therefore we only potentially block when we are not buffering. */
|
2013-05-24 17:22:22 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing);
|
2014-04-16 14:17:04 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue) && (gst_queue2_is_empty (queue)
|
|
|
|
|| !queue->use_buffering)) {
|
|
|
|
if (!g_atomic_int_get (&queue->downstream_may_block)) {
|
|
|
|
gst_queue2_locked_enqueue (queue, query,
|
|
|
|
GST_QUEUE2_ITEM_TYPE_QUERY);
|
|
|
|
|
|
|
|
STATUS (queue, queue->sinkpad, "wait for QUERY");
|
2016-12-13 18:51:17 +00:00
|
|
|
while (queue->sinkresult == GST_FLOW_OK &&
|
|
|
|
queue->last_handled_query != query)
|
|
|
|
g_cond_wait (&queue->query_handled, &queue->qlock);
|
|
|
|
queue->last_handled_query = NULL;
|
2014-04-16 14:17:04 +00:00
|
|
|
if (queue->sinkresult != GST_FLOW_OK)
|
|
|
|
goto out_flushing;
|
|
|
|
res = queue->last_query;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue, "refusing query, downstream might block");
|
|
|
|
res = FALSE;
|
|
|
|
}
|
2013-05-24 17:22:22 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"refusing query, we are not using the queue");
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
2012-03-14 14:42:47 +00:00
|
|
|
} else {
|
|
|
|
res = gst_pad_query_default (pad, parent, query);
|
|
|
|
}
|
2011-11-09 16:36:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
2013-05-24 17:22:22 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2017-01-22 14:26:56 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "refusing query, we are %s",
|
|
|
|
gst_flow_get_name (queue->sinkresult));
|
2013-05-24 17:22:22 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-11-09 16:36:00 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_is_empty (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
/* never empty on EOS */
|
|
|
|
if (queue->is_eos)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue) && queue->current) {
|
2010-05-07 07:30:44 +00:00
|
|
|
return queue->current->writing_pos <= queue->current->max_reading_pos;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
} else {
|
2018-06-02 12:02:19 +00:00
|
|
|
if (gst_queue_array_get_length (queue->queue) == 0)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_is_filled (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
/* always filled on EOS */
|
|
|
|
if (queue->is_eos)
|
|
|
|
return TRUE;
|
|
|
|
|
2020-05-06 06:04:28 +00:00
|
|
|
/* Check the levels if non-null */
|
|
|
|
#define CHECK_FILLED_REAL(format) \
|
|
|
|
((queue->max_level.format) > 0 && (queue->cur_level.format) >= ((queue->max_level.format)))
|
|
|
|
/* Check the levels if non-null (use the alternative max if non-zero) */
|
|
|
|
#define CHECK_FILLED_ALT(format,alt_max) ((queue->max_level.format) > 0 && \
|
2010-06-15 10:37:33 +00:00
|
|
|
(queue->cur_level.format) >= ((alt_max) ? \
|
|
|
|
MIN ((queue->max_level.format), (alt_max)) : (queue->max_level.format)))
|
2010-06-06 07:30:48 +00:00
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
/* if using a ring buffer we're filled if all ring buffer space is used
|
|
|
|
* _by the current range_ */
|
2010-05-18 15:21:40 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
guint64 rb_size = queue->ring_buffer_max_size;
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
2010-09-23 12:12:32 +00:00
|
|
|
"max bytes %u, rb size %" G_GUINT64_FORMAT ", cur bytes %u",
|
|
|
|
queue->max_level.bytes, rb_size, queue->cur_level.bytes);
|
2020-05-06 06:04:28 +00:00
|
|
|
return CHECK_FILLED_ALT (bytes, rb_size);
|
2010-05-18 15:21:40 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* if using file, we're never filled if we don't have EOS */
|
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue))
|
|
|
|
return FALSE;
|
|
|
|
|
2008-03-24 14:08:22 +00:00
|
|
|
/* we are never filled when we have no buffers at all */
|
|
|
|
if (queue->cur_level.buffers == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* we are filled if one of the current levels exceeds the max */
|
2020-05-06 06:04:28 +00:00
|
|
|
res = CHECK_FILLED_REAL (buffers) || CHECK_FILLED_REAL (bytes)
|
|
|
|
|| CHECK_FILLED_REAL (time);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* if we need to, use the rate estimate to check against the max time we are
|
|
|
|
* allowed to queue */
|
|
|
|
if (queue->use_rate_estimate)
|
2020-05-06 06:04:28 +00:00
|
|
|
res |= CHECK_FILLED_REAL (rate_time);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2020-05-06 06:04:28 +00:00
|
|
|
#undef CHECK_FILLED_REAL
|
|
|
|
#undef CHECK_FILLED_ALT
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-11-03 10:34:49 +00:00
|
|
|
gst_queue2_chain_buffer_or_buffer_list (GstQueue2 * queue,
|
|
|
|
GstMiniObject * item, GstQueue2ItemType item_type)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
/* we have to lock the queue since we span threads */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing);
|
2007-09-17 16:22:17 +00:00
|
|
|
/* when we received EOS, we refuse more data */
|
|
|
|
if (queue->is_eos)
|
|
|
|
goto out_eos;
|
|
|
|
/* when we received unexpected from downstream, refuse more buffers */
|
|
|
|
if (queue->unexpected)
|
|
|
|
goto out_unexpected;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2012-04-10 09:20:09 +00:00
|
|
|
/* while we didn't receive the newsegment, we're seeking and we skip data */
|
|
|
|
if (queue->seeking)
|
|
|
|
goto out_seeking;
|
|
|
|
|
2010-06-15 10:37:33 +00:00
|
|
|
if (!gst_queue2_wait_free_space (queue))
|
|
|
|
goto out_flushing;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* put buffer in queue now */
|
2011-11-03 10:34:49 +00:00
|
|
|
gst_queue2_locked_enqueue (queue, item, item_type);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* special conditions */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2010-03-24 17:18:13 +00:00
|
|
|
GstFlowReturn ret = queue->sinkresult;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"exit because task paused, reason: %s", gst_flow_get_name (ret));
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2011-11-03 10:34:49 +00:00
|
|
|
gst_mini_object_unref (item);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2007-09-17 16:22:17 +00:00
|
|
|
out_eos:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2011-11-03 10:34:49 +00:00
|
|
|
gst_mini_object_unref (item);
|
2007-09-17 16:22:17 +00:00
|
|
|
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2007-09-17 16:22:17 +00:00
|
|
|
}
|
2012-04-10 09:20:09 +00:00
|
|
|
out_seeking:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we are seeking");
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
gst_mini_object_unref (item);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2007-09-17 16:22:17 +00:00
|
|
|
out_unexpected:
|
|
|
|
{
|
2011-10-10 09:33:51 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2011-11-03 10:34:49 +00:00
|
|
|
gst_mini_object_unref (item);
|
2007-09-17 16:22:17 +00:00
|
|
|
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2007-09-17 16:22:17 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2011-11-03 10:34:49 +00:00
|
|
|
static GstFlowReturn
|
2011-11-28 00:40:55 +00:00
|
|
|
gst_queue2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
2011-11-03 10:34:49 +00:00
|
|
|
{
|
|
|
|
GstQueue2 *queue;
|
|
|
|
|
2011-11-28 00:40:55 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
2011-11-03 10:34:49 +00:00
|
|
|
|
2011-11-28 00:40:55 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "received buffer %p of "
|
|
|
|
"size %" G_GSIZE_FORMAT ", time %" GST_TIME_FORMAT ", duration %"
|
2011-11-28 01:00:28 +00:00
|
|
|
GST_TIME_FORMAT, buffer, gst_buffer_get_size (buffer),
|
2011-11-03 10:34:49 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)));
|
|
|
|
|
|
|
|
return gst_queue2_chain_buffer_or_buffer_list (queue,
|
|
|
|
GST_MINI_OBJECT_CAST (buffer), GST_QUEUE2_ITEM_TYPE_BUFFER);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-11-28 00:40:55 +00:00
|
|
|
gst_queue2_chain_list (GstPad * pad, GstObject * parent,
|
|
|
|
GstBufferList * buffer_list)
|
2011-11-03 10:34:49 +00:00
|
|
|
{
|
|
|
|
GstQueue2 *queue;
|
|
|
|
|
2011-11-28 00:40:55 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"received buffer list %p", buffer_list);
|
|
|
|
|
|
|
|
return gst_queue2_chain_buffer_or_buffer_list (queue,
|
|
|
|
GST_MINI_OBJECT_CAST (buffer_list), GST_QUEUE2_ITEM_TYPE_BUFFER_LIST);
|
|
|
|
}
|
|
|
|
|
2011-11-03 13:02:36 +00:00
|
|
|
static GstMiniObject *
|
2011-11-28 00:40:55 +00:00
|
|
|
gst_queue2_dequeue_on_eos (GstQueue2 * queue, GstQueue2ItemType * item_type)
|
2011-11-03 13:02:36 +00:00
|
|
|
{
|
|
|
|
GstMiniObject *data;
|
|
|
|
|
2011-11-28 00:40:55 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "got EOS from downstream");
|
2011-11-03 13:02:36 +00:00
|
|
|
|
|
|
|
/* stop pushing buffers, we dequeue all items until we see an item that we
|
2011-11-28 00:40:55 +00:00
|
|
|
* can push again, which is EOS or SEGMENT. If there is nothing in the
|
2011-11-03 13:02:36 +00:00
|
|
|
* queue we can push, we set a flag to make the sinkpad refuse more
|
2011-11-28 00:40:55 +00:00
|
|
|
* buffers with an EOS return value until we receive something
|
2011-11-03 13:02:36 +00:00
|
|
|
* pushable again or we get flushed. */
|
|
|
|
while ((data = gst_queue2_locked_dequeue (queue, item_type))) {
|
|
|
|
if (*item_type == GST_QUEUE2_ITEM_TYPE_BUFFER) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
2011-11-28 00:40:55 +00:00
|
|
|
"dropping EOS buffer %p", data);
|
2011-11-03 13:02:36 +00:00
|
|
|
gst_buffer_unref (GST_BUFFER_CAST (data));
|
|
|
|
} else if (*item_type == GST_QUEUE2_ITEM_TYPE_EVENT) {
|
|
|
|
GstEvent *event = GST_EVENT_CAST (data);
|
|
|
|
GstEventType type = GST_EVENT_TYPE (event);
|
|
|
|
|
2017-08-09 08:51:39 +00:00
|
|
|
if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT
|
|
|
|
|| type == GST_EVENT_STREAM_START) {
|
2011-11-03 13:02:36 +00:00
|
|
|
/* we found a pushable item in the queue, push it out */
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
2011-11-28 00:40:55 +00:00
|
|
|
"pushing pushable event %s after EOS", GST_EVENT_TYPE_NAME (event));
|
2011-11-03 13:02:36 +00:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
2011-11-28 00:40:55 +00:00
|
|
|
"dropping EOS event %p", event);
|
2011-11-03 13:02:36 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
} else if (*item_type == GST_QUEUE2_ITEM_TYPE_BUFFER_LIST) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
2011-11-28 00:40:55 +00:00
|
|
|
"dropping EOS buffer list %p", data);
|
2011-11-03 13:02:36 +00:00
|
|
|
gst_buffer_list_unref (GST_BUFFER_LIST_CAST (data));
|
2013-05-24 17:22:22 +00:00
|
|
|
} else if (*item_type == GST_QUEUE2_ITEM_TYPE_QUERY) {
|
|
|
|
queue->last_query = FALSE;
|
|
|
|
g_cond_signal (&queue->query_handled);
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "dropping EOS query %p", data);
|
2011-11-03 13:02:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* no more items in the queue. Set the unexpected flag so that upstream
|
|
|
|
* make us refuse any more buffers on the sinkpad. Since we will still
|
2011-11-28 00:40:55 +00:00
|
|
|
* accept EOS and SEGMENT we return _FLOW_OK to the caller so that the
|
2011-11-03 13:02:36 +00:00
|
|
|
* task function does not shut down. */
|
|
|
|
queue->unexpected = TRUE;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* dequeue an item from the queue an push it downstream. This functions returns
|
|
|
|
* the result of the push. */
|
|
|
|
static GstFlowReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_push_one (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2018-10-22 11:45:52 +00:00
|
|
|
GstFlowReturn result;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstMiniObject *data;
|
2011-11-03 08:55:20 +00:00
|
|
|
GstQueue2ItemType item_type;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-03 08:55:20 +00:00
|
|
|
data = gst_queue2_locked_dequeue (queue, &item_type);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (data == NULL)
|
|
|
|
goto no_item;
|
|
|
|
|
2007-09-17 16:22:17 +00:00
|
|
|
next:
|
2018-10-22 11:45:52 +00:00
|
|
|
result = queue->srcresult;
|
2014-04-16 14:17:04 +00:00
|
|
|
STATUS (queue, queue->srcpad, "We have something dequeud");
|
|
|
|
g_atomic_int_set (&queue->downstream_may_block,
|
|
|
|
item_type == GST_QUEUE2_ITEM_TYPE_BUFFER ||
|
|
|
|
item_type == GST_QUEUE2_ITEM_TYPE_BUFFER_LIST);
|
2010-10-19 15:43:56 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
2010-10-19 15:43:56 +00:00
|
|
|
|
2020-05-26 17:41:37 +00:00
|
|
|
if (gst_pad_check_reconfigure (queue->srcpad)) {
|
|
|
|
/* If the pad was reconfigured, do a new bitrate query */
|
|
|
|
query_downstream_bitrate (queue);
|
|
|
|
}
|
|
|
|
|
2011-11-03 08:55:20 +00:00
|
|
|
if (item_type == GST_QUEUE2_ITEM_TYPE_BUFFER) {
|
2007-10-15 11:38:39 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
buffer = GST_BUFFER_CAST (data);
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
result = gst_pad_push (queue->srcpad, buffer);
|
2014-04-16 14:17:04 +00:00
|
|
|
g_atomic_int_set (&queue->downstream_may_block, 0);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* need to check for srcresult here as well */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
2011-10-10 09:33:51 +00:00
|
|
|
if (result == GST_FLOW_EOS) {
|
2011-11-28 00:40:55 +00:00
|
|
|
data = gst_queue2_dequeue_on_eos (queue, &item_type);
|
2011-11-03 13:02:36 +00:00
|
|
|
if (data != NULL)
|
|
|
|
goto next;
|
2011-11-28 01:12:48 +00:00
|
|
|
/* Since we will still accept EOS and SEGMENT we return _FLOW_OK
|
2011-11-28 01:10:20 +00:00
|
|
|
* to the caller so that the task function does not shut down */
|
|
|
|
result = GST_FLOW_OK;
|
2007-09-17 16:22:17 +00:00
|
|
|
}
|
2011-11-03 08:55:20 +00:00
|
|
|
} else if (item_type == GST_QUEUE2_ITEM_TYPE_EVENT) {
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstEvent *event = GST_EVENT_CAST (data);
|
|
|
|
GstEventType type = GST_EVENT_TYPE (event);
|
|
|
|
|
2015-11-11 14:14:34 +00:00
|
|
|
if (type == GST_EVENT_TAG) {
|
|
|
|
if (queue->use_tags_bitrate) {
|
|
|
|
GstTagList *tags;
|
|
|
|
guint bitrate;
|
|
|
|
|
|
|
|
gst_event_parse_tag (event, &tags);
|
|
|
|
if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &bitrate) ||
|
|
|
|
gst_tag_list_get_uint (tags, GST_TAG_NOMINAL_BITRATE, &bitrate)) {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->src_tags_bitrate = bitrate;
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
GST_LOG_OBJECT (queue, "src pad bitrate from tags now %u", bitrate);
|
2019-10-31 10:06:48 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (queue), obj_props[PROP_BITRATE]);
|
2015-11-11 14:14:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_push_event (queue->srcpad, event);
|
|
|
|
|
2011-10-10 09:33:51 +00:00
|
|
|
/* if we're EOS, return EOS so that the task pauses. */
|
2007-09-17 16:22:17 +00:00
|
|
|
if (type == GST_EVENT_EOS) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
2011-10-10 09:33:51 +00:00
|
|
|
"pushed EOS event %p, return EOS", event);
|
|
|
|
result = GST_FLOW_EOS;
|
2007-09-17 16:22:17 +00:00
|
|
|
}
|
2010-10-19 15:43:56 +00:00
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
2011-11-03 10:34:49 +00:00
|
|
|
} else if (item_type == GST_QUEUE2_ITEM_TYPE_BUFFER_LIST) {
|
|
|
|
GstBufferList *buffer_list;
|
|
|
|
|
|
|
|
buffer_list = GST_BUFFER_LIST_CAST (data);
|
|
|
|
|
|
|
|
result = gst_pad_push_list (queue->srcpad, buffer_list);
|
2014-04-16 14:17:04 +00:00
|
|
|
g_atomic_int_set (&queue->downstream_may_block, 0);
|
2011-11-03 10:34:49 +00:00
|
|
|
|
|
|
|
/* need to check for srcresult here as well */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
2011-11-28 00:40:55 +00:00
|
|
|
if (result == GST_FLOW_EOS) {
|
|
|
|
data = gst_queue2_dequeue_on_eos (queue, &item_type);
|
2011-11-03 10:34:49 +00:00
|
|
|
if (data != NULL)
|
|
|
|
goto next;
|
2011-11-28 01:12:48 +00:00
|
|
|
/* Since we will still accept EOS and SEGMENT we return _FLOW_OK
|
2011-11-28 01:10:20 +00:00
|
|
|
* to the caller so that the task function does not shut down */
|
|
|
|
result = GST_FLOW_OK;
|
2011-11-03 10:34:49 +00:00
|
|
|
}
|
2013-05-24 17:22:22 +00:00
|
|
|
} else if (item_type == GST_QUEUE2_ITEM_TYPE_QUERY) {
|
|
|
|
GstQuery *query = GST_QUERY_CAST (data);
|
|
|
|
|
2014-04-16 14:17:04 +00:00
|
|
|
GST_LOG_OBJECT (queue->srcpad, "Peering query %p", query);
|
2016-12-13 18:51:17 +00:00
|
|
|
queue->last_handled_query = query;
|
2013-05-24 17:22:22 +00:00
|
|
|
queue->last_query = gst_pad_peer_query (queue->srcpad, query);
|
2014-04-16 14:17:04 +00:00
|
|
|
GST_LOG_OBJECT (queue->srcpad, "Peered query");
|
2013-05-24 17:22:22 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"did query %p, return %d", query, queue->last_query);
|
|
|
|
g_cond_signal (&queue->query_handled);
|
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
|
|
|
result = GST_FLOW_OK;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_item:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"exit because we have no item in the queue");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
out_flushing:
|
|
|
|
{
|
2017-01-22 14:26:56 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we are %s",
|
|
|
|
gst_flow_get_name (queue->srcresult));
|
|
|
|
return queue->srcresult;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-07 11:14:38 +00:00
|
|
|
/* called repeatedly with @pad as the source pad. This function should push out
|
2007-06-06 13:36:26 +00:00
|
|
|
* data to the peer element. */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_loop (GstPad * pad)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* have to lock for thread-safety */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
if (gst_queue2_is_empty (queue)) {
|
2007-12-14 18:46:12 +00:00
|
|
|
gboolean started;
|
|
|
|
|
|
|
|
/* pause the timer while we wait. The fact that we are waiting does not mean
|
|
|
|
* the byterate on the output pad is lower */
|
|
|
|
if ((started = queue->out_timer_started))
|
|
|
|
g_timer_stop (queue->out_timer);
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
|
|
|
"queue is empty, waiting for new data");
|
|
|
|
do {
|
|
|
|
/* Wait for data to be available, we could be unlocked because of a flush. */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
2007-12-14 18:46:12 +00:00
|
|
|
}
|
2009-10-29 10:30:11 +00:00
|
|
|
while (gst_queue2_is_empty (queue));
|
2007-12-14 18:46:12 +00:00
|
|
|
|
|
|
|
/* and continue if we were running before */
|
|
|
|
if (started)
|
|
|
|
g_timer_continue (queue->out_timer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2009-10-29 10:30:11 +00:00
|
|
|
ret = gst_queue2_push_one (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = ret;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = ret;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto out_flushing;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2009-08-06 10:18:36 +00:00
|
|
|
gboolean eos = queue->is_eos;
|
|
|
|
GstFlowReturn ret = queue->srcresult;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_pause_task (queue->srcpad);
|
2015-03-03 11:53:13 +00:00
|
|
|
if (ret == GST_FLOW_FLUSHING) {
|
|
|
|
gst_queue2_locked_flush (queue, FALSE, FALSE);
|
|
|
|
} else {
|
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
|
|
|
queue->last_query = FALSE;
|
|
|
|
g_cond_signal (&queue->query_handled);
|
|
|
|
}
|
2010-10-19 15:43:56 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"pause task, reason: %s", gst_flow_get_name (queue->srcresult));
|
2017-08-07 10:24:37 +00:00
|
|
|
/* Recalculate buffering levels before stopping since the source flow
|
|
|
|
* might cause a different buffering level (like NOT_LINKED making
|
|
|
|
* the queue appear as full) */
|
|
|
|
if (queue->use_buffering)
|
|
|
|
update_buffering (queue);
|
|
|
|
gst_queue2_post_buffering (queue);
|
2009-08-06 10:18:36 +00:00
|
|
|
/* let app know about us giving up if upstream is not expected to do so */
|
2011-10-10 09:33:51 +00:00
|
|
|
/* EOS is already taken care of elsewhere */
|
|
|
|
if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS)) {
|
2016-08-23 16:27:58 +00:00
|
|
|
GST_ELEMENT_FLOW_ERROR (queue, ret);
|
2009-08-06 10:18:36 +00:00
|
|
|
gst_pad_push_event (queue->srcpad, gst_event_new_eos ());
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_queue2_handle_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
2011-11-17 11:40:45 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (parent);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "got event %p (%s)",
|
|
|
|
event, GST_EVENT_TYPE_NAME (event));
|
|
|
|
#endif
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_START:
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-24 17:18:13 +00:00
|
|
|
/* just forward upstream */
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
} else {
|
|
|
|
/* now unblock the getrange function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
GST_DEBUG_OBJECT (queue, "flushing");
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* when using a temp file, we eat the event */
|
|
|
|
res = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-24 17:18:13 +00:00
|
|
|
/* just forward upstream */
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
} else {
|
|
|
|
/* now unblock the getrange function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->srcresult = GST_FLOW_OK;
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* when using a temp file, we eat the event */
|
|
|
|
res = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
break;
|
2013-04-04 17:07:29 +00:00
|
|
|
case GST_EVENT_RECONFIGURE:
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
/* assume downstream is linked now and try to push again */
|
|
|
|
if (queue->srcresult == GST_FLOW_NOT_LINKED) {
|
2020-05-26 17:41:37 +00:00
|
|
|
/* Mark the pad as needing reconfiguration, and
|
|
|
|
* the loop will re-query downstream bitrate
|
|
|
|
*/
|
|
|
|
gst_pad_mark_reconfigure (pad);
|
2013-04-04 17:07:29 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
|
|
|
if (GST_PAD_MODE (pad) == GST_PAD_MODE_PUSH) {
|
|
|
|
gst_pad_start_task (pad, (GstTaskFunction) gst_queue2_loop, pad,
|
|
|
|
NULL);
|
|
|
|
}
|
2018-05-17 11:42:43 +00:00
|
|
|
|
2013-04-04 17:07:29 +00:00
|
|
|
}
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
break;
|
2010-03-24 17:18:13 +00:00
|
|
|
default:
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
break;
|
2008-04-02 11:08:05 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2007-06-11 11:32:26 +00:00
|
|
|
static gboolean
|
2011-11-16 16:22:56 +00:00
|
|
|
gst_queue2_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
2007-06-11 11:32:26 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-11 11:32:26 +00:00
|
|
|
|
2011-11-16 16:22:56 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-05-17 09:20:05 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
{
|
|
|
|
gint64 peer_pos;
|
|
|
|
GstFormat format;
|
|
|
|
|
2011-11-09 16:36:00 +00:00
|
|
|
if (!gst_pad_peer_query (queue->sinkpad, query))
|
2007-06-11 11:32:26 +00:00
|
|
|
goto peer_failed;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* get peer position */
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_parse_position (query, &format, &peer_pos);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* FIXME: this code assumes that there's no discont in the queue */
|
|
|
|
switch (format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
peer_pos -= queue->cur_level.bytes;
|
2016-11-15 11:39:43 +00:00
|
|
|
if (peer_pos < 0) /* Clamp result to 0 */
|
|
|
|
peer_pos = 0;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
peer_pos -= queue->cur_level.time;
|
2016-11-15 11:39:43 +00:00
|
|
|
if (peer_pos < 0) /* Clamp result to 0 */
|
|
|
|
peer_pos = 0;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (queue, "dropping query in %s format, don't "
|
|
|
|
"know how to adjust value", gst_format_get_name (format));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
/* set updated position */
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_set_position (query, format, peer_pos);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-11 11:32:26 +00:00
|
|
|
case GST_QUERY_DURATION:
|
|
|
|
{
|
2008-04-02 11:08:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "doing peer query");
|
2007-06-11 11:32:26 +00:00
|
|
|
|
2011-11-09 16:36:00 +00:00
|
|
|
if (!gst_pad_peer_query (queue->sinkpad, query))
|
2007-06-11 11:32:26 +00:00
|
|
|
goto peer_failed;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "peer query success");
|
|
|
|
break;
|
|
|
|
}
|
2008-04-09 21:40:17 +00:00
|
|
|
case GST_QUERY_BUFFERING:
|
|
|
|
{
|
2012-12-20 10:59:54 +00:00
|
|
|
gint percent;
|
|
|
|
gboolean is_buffering;
|
|
|
|
GstBufferingMode mode;
|
|
|
|
gint avg_in, avg_out;
|
|
|
|
gint64 buffering_left;
|
2008-04-09 21:40:17 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "query buffering");
|
|
|
|
|
2016-08-03 13:27:40 +00:00
|
|
|
get_buffering_level (queue, &is_buffering, &percent);
|
|
|
|
percent = convert_to_buffering_percent (queue, percent);
|
2012-12-20 10:59:54 +00:00
|
|
|
gst_query_set_buffering_percent (query, is_buffering, percent);
|
|
|
|
|
|
|
|
get_buffering_stats (queue, percent, &mode, &avg_in, &avg_out,
|
|
|
|
&buffering_left);
|
|
|
|
gst_query_set_buffering_stats (query, mode, avg_in, avg_out,
|
|
|
|
buffering_left);
|
|
|
|
|
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
/* add ranges for download and ringbuffer buffering */
|
|
|
|
GstFormat format;
|
2010-08-31 09:37:42 +00:00
|
|
|
gint64 start, stop, range_start, range_stop;
|
2010-03-23 18:25:29 +00:00
|
|
|
guint64 writing_pos;
|
2012-12-20 10:59:54 +00:00
|
|
|
gint64 estimated_total;
|
2010-03-24 18:02:12 +00:00
|
|
|
gint64 duration;
|
2012-12-20 10:59:54 +00:00
|
|
|
gboolean peer_res, is_eos;
|
2010-08-31 09:37:42 +00:00
|
|
|
GstQueue2Range *queued_ranges;
|
2010-03-24 18:02:12 +00:00
|
|
|
|
|
|
|
/* we need a current download region */
|
|
|
|
if (queue->current == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
writing_pos = queue->current->writing_pos;
|
2010-04-09 10:35:47 +00:00
|
|
|
is_eos = queue->is_eos;
|
2010-03-24 18:02:12 +00:00
|
|
|
|
2010-04-09 10:35:47 +00:00
|
|
|
if (is_eos) {
|
|
|
|
/* we're EOS, we know the duration in bytes now */
|
|
|
|
peer_res = TRUE;
|
|
|
|
duration = writing_pos;
|
|
|
|
} else {
|
|
|
|
/* get duration of upstream in bytes */
|
2011-11-15 16:50:34 +00:00
|
|
|
peer_res = gst_pad_peer_query_duration (queue->sinkpad,
|
2011-07-26 23:28:19 +00:00
|
|
|
GST_FORMAT_BYTES, &duration);
|
2010-04-09 10:35:47 +00:00
|
|
|
}
|
2010-03-24 18:02:12 +00:00
|
|
|
|
2012-07-19 10:42:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "percent %d, duration %" G_GINT64_FORMAT
|
|
|
|
", writing %" G_GINT64_FORMAT, percent, duration, writing_pos);
|
|
|
|
|
2010-03-24 18:02:12 +00:00
|
|
|
/* calculate remaining and total download time */
|
2012-12-20 10:59:54 +00:00
|
|
|
if (peer_res && avg_in > 0.0)
|
|
|
|
estimated_total = ((duration - writing_pos) * 1000) / avg_in;
|
2012-07-19 10:42:05 +00:00
|
|
|
else
|
|
|
|
estimated_total = -1;
|
2012-07-19 10:14:29 +00:00
|
|
|
|
2012-12-20 10:59:54 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "estimated-total %" G_GINT64_FORMAT,
|
|
|
|
estimated_total);
|
2008-04-09 21:40:17 +00:00
|
|
|
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_parse_buffering_range (query, &format, NULL, NULL, NULL);
|
2008-04-09 21:40:17 +00:00
|
|
|
|
|
|
|
switch (format) {
|
|
|
|
case GST_FORMAT_PERCENT:
|
2010-03-24 18:02:12 +00:00
|
|
|
/* we need duration */
|
|
|
|
if (!peer_res)
|
2008-04-09 21:40:17 +00:00
|
|
|
goto peer_failed;
|
|
|
|
|
|
|
|
start = 0;
|
|
|
|
/* get our available data relative to the duration */
|
|
|
|
if (duration != -1)
|
2012-06-15 13:36:41 +00:00
|
|
|
stop =
|
|
|
|
gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX, writing_pos,
|
|
|
|
duration);
|
2008-04-09 21:40:17 +00:00
|
|
|
else
|
|
|
|
stop = -1;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
start = 0;
|
2010-03-24 18:02:12 +00:00
|
|
|
stop = writing_pos;
|
2008-04-09 21:40:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
start = -1;
|
|
|
|
stop = -1;
|
|
|
|
break;
|
|
|
|
}
|
2010-08-31 09:37:42 +00:00
|
|
|
|
|
|
|
/* fill out the buffered ranges */
|
|
|
|
for (queued_ranges = queue->ranges; queued_ranges;
|
|
|
|
queued_ranges = queued_ranges->next) {
|
|
|
|
switch (format) {
|
|
|
|
case GST_FORMAT_PERCENT:
|
|
|
|
if (duration == -1) {
|
|
|
|
range_start = 0;
|
|
|
|
range_stop = 0;
|
|
|
|
break;
|
|
|
|
}
|
2012-06-15 13:36:41 +00:00
|
|
|
range_start =
|
|
|
|
gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX,
|
|
|
|
queued_ranges->offset, duration);
|
|
|
|
range_stop =
|
|
|
|
gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX,
|
|
|
|
queued_ranges->writing_pos, duration);
|
2010-08-31 09:37:42 +00:00
|
|
|
break;
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
range_start = queued_ranges->offset;
|
|
|
|
range_stop = queued_ranges->writing_pos;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
range_start = -1;
|
|
|
|
range_stop = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (range_start == range_stop)
|
|
|
|
continue;
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"range starting at %" G_GINT64_FORMAT " and finishing at %"
|
|
|
|
G_GINT64_FORMAT, range_start, range_stop);
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_add_buffering_range (query, range_start, range_stop);
|
2010-08-31 09:37:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-19 10:14:29 +00:00
|
|
|
gst_query_set_buffering_range (query, format, start, stop,
|
|
|
|
estimated_total);
|
2008-04-09 21:40:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2011-05-24 15:36:24 +00:00
|
|
|
case GST_QUERY_SCHEDULING:
|
|
|
|
{
|
|
|
|
gboolean pull_mode;
|
2011-11-18 16:27:16 +00:00
|
|
|
GstSchedulingFlags flags = 0;
|
2011-05-24 15:36:24 +00:00
|
|
|
|
2013-07-26 13:08:13 +00:00
|
|
|
if (!gst_pad_peer_query (queue->sinkpad, query))
|
|
|
|
goto peer_failed;
|
|
|
|
|
|
|
|
gst_query_parse_scheduling (query, &flags, NULL, NULL, NULL);
|
|
|
|
|
2011-05-24 15:36:24 +00:00
|
|
|
/* we can operate in pull mode when we are using a tempfile */
|
|
|
|
pull_mode = !QUEUE_IS_USING_QUEUE (queue);
|
|
|
|
|
2011-11-18 16:27:16 +00:00
|
|
|
if (pull_mode)
|
|
|
|
flags |= GST_SCHEDULING_FLAG_SEEKABLE;
|
|
|
|
gst_query_set_scheduling (query, flags, 0, -1, 0);
|
|
|
|
if (pull_mode)
|
|
|
|
gst_query_add_scheduling_mode (query, GST_PAD_MODE_PULL);
|
|
|
|
gst_query_add_scheduling_mode (query, GST_PAD_MODE_PUSH);
|
2011-05-24 15:36:24 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
/* peer handled other queries */
|
2011-11-16 16:22:56 +00:00
|
|
|
if (!gst_pad_query_default (pad, parent, query))
|
2007-06-11 11:32:26 +00:00
|
|
|
goto peer_failed;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2007-06-11 11:32:26 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
peer_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "failed peer query");
|
|
|
|
return FALSE;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-03-25 17:13:02 +00:00
|
|
|
static gboolean
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_queue2_handle_query (GstElement * element, GstQuery * query)
|
2010-03-25 17:13:02 +00:00
|
|
|
{
|
2011-11-16 16:22:56 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (element);
|
|
|
|
|
2010-03-25 17:13:02 +00:00
|
|
|
/* simply forward to the srcpad query function */
|
2011-11-16 16:22:56 +00:00
|
|
|
return gst_queue2_handle_src_query (queue->srcpad, GST_OBJECT_CAST (element),
|
|
|
|
query);
|
2010-03-25 17:13:02 +00:00
|
|
|
}
|
|
|
|
|
2010-10-31 19:47:25 +00:00
|
|
|
static void
|
|
|
|
gst_queue2_update_upstream_size (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
gint64 upstream_size = -1;
|
|
|
|
|
2011-11-15 16:50:34 +00:00
|
|
|
if (gst_pad_peer_query_duration (queue->sinkpad, GST_FORMAT_BYTES,
|
2011-07-26 23:28:19 +00:00
|
|
|
&upstream_size)) {
|
2010-10-31 19:47:25 +00:00
|
|
|
GST_INFO_OBJECT (queue, "upstream size: %" G_GINT64_FORMAT, upstream_size);
|
2015-08-04 04:45:09 +00:00
|
|
|
|
|
|
|
/* upstream_size can be negative but queue->upstream_size is unsigned.
|
|
|
|
* Prevent setting negative values to it (the query can return -1) */
|
|
|
|
if (upstream_size >= 0)
|
|
|
|
queue->upstream_size = upstream_size;
|
|
|
|
else
|
|
|
|
queue->upstream_size = 0;
|
2010-10-31 19:47:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_queue2_get_range (GstPad * pad, GstObject * parent, guint64 offset,
|
|
|
|
guint length, GstBuffer ** buffer)
|
2007-06-06 13:36:26 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-06 13:36:26 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
queue = GST_QUEUE2_CAST (parent);
|
2007-06-06 13:36:26 +00:00
|
|
|
|
|
|
|
length = (length == -1) ? DEFAULT_BUFFER_SIZE : length;
|
2010-10-19 15:43:56 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
2010-06-16 09:11:32 +00:00
|
|
|
offset = (offset == -1) ? queue->current->reading_pos : offset;
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2010-05-19 14:04:15 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Getting range: offset %" G_GUINT64_FORMAT ", length %u", offset, length);
|
2010-10-31 19:47:25 +00:00
|
|
|
|
|
|
|
/* catch any reads beyond the size of the file here to make sure queue2
|
|
|
|
* doesn't send seek events beyond the size of the file upstream, since
|
|
|
|
* that would confuse elements such as souphttpsrc and/or http servers.
|
|
|
|
* Demuxers often just loop until EOS at the end of the file to figure out
|
|
|
|
* when they've read all the end-headers or index chunks. */
|
|
|
|
if (G_UNLIKELY (offset >= queue->upstream_size)) {
|
|
|
|
gst_queue2_update_upstream_size (queue);
|
|
|
|
if (queue->upstream_size > 0 && offset >= queue->upstream_size)
|
|
|
|
goto out_unexpected;
|
|
|
|
}
|
|
|
|
|
2011-02-15 13:42:58 +00:00
|
|
|
if (G_UNLIKELY (offset + length > queue->upstream_size)) {
|
|
|
|
gst_queue2_update_upstream_size (queue);
|
|
|
|
if (queue->upstream_size > 0 && offset + length >= queue->upstream_size) {
|
|
|
|
length = queue->upstream_size - offset;
|
|
|
|
GST_DEBUG_OBJECT (queue, "adjusting length downto %d", length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
/* FIXME - function will block when the range is not yet available */
|
2009-10-29 10:30:11 +00:00
|
|
|
ret = gst_queue2_create_read (queue, offset, length, buffer);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2010-03-24 17:18:13 +00:00
|
|
|
ret = queue->srcresult;
|
|
|
|
|
2017-01-22 14:26:56 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "we are %s", gst_flow_get_name (ret));
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2010-03-24 17:18:13 +00:00
|
|
|
return ret;
|
2007-06-06 13:36:26 +00:00
|
|
|
}
|
2010-10-31 19:47:25 +00:00
|
|
|
out_unexpected:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "read beyond end of file");
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2010-10-31 19:47:25 +00:00
|
|
|
}
|
2007-06-06 13:36:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sink currently only operates in push mode */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static gboolean
|
2011-11-21 12:29:05 +00:00
|
|
|
gst_queue2_sink_activate_mode (GstPad * pad, GstObject * parent,
|
|
|
|
GstPadMode mode, gboolean active)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2011-11-21 12:29:05 +00:00
|
|
|
gboolean result;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-18 12:46:46 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-21 12:29:05 +00:00
|
|
|
switch (mode) {
|
|
|
|
case GST_PAD_MODE_PUSH:
|
|
|
|
if (active) {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
GST_DEBUG_OBJECT (queue, "activating push mode");
|
|
|
|
queue->srcresult = GST_FLOW_OK;
|
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
|
|
|
reset_rate_timer (queue);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
} else {
|
|
|
|
/* unblock chain function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
GST_DEBUG_OBJECT (queue, "deactivating push mode");
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
2013-08-20 08:16:05 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
2013-08-19 14:38:40 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* wait until it is unblocked and clean up */
|
|
|
|
GST_PAD_STREAM_LOCK (pad);
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2014-02-18 14:46:32 +00:00
|
|
|
gst_queue2_locked_flush (queue, TRUE, FALSE);
|
2011-11-21 12:29:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2013-08-19 14:38:40 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (pad);
|
2011-11-21 12:29:05 +00:00
|
|
|
}
|
|
|
|
result = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
result = FALSE;
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* src operating in push mode, we start a task on the source pad that pushes out
|
|
|
|
* buffers from the queue */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static gboolean
|
2011-11-18 12:46:46 +00:00
|
|
|
gst_queue2_src_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean result = FALSE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2011-11-18 12:46:46 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
if (active) {
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "activating push mode");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2007-09-17 16:22:17 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2012-06-20 08:31:49 +00:00
|
|
|
result =
|
|
|
|
gst_pad_start_task (pad, (GstTaskFunction) gst_queue2_loop, pad, NULL);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
|
|
|
/* unblock loop function */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "deactivating push mode");
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* the item add signal will unblock */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* step 2, make sure streaming finishes */
|
|
|
|
result = gst_pad_stop_task (pad);
|
2016-12-13 18:00:55 +00:00
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
gst_queue2_locked_flush (queue, FALSE, FALSE);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* pull mode, downstream will call our getrange function */
|
|
|
|
static gboolean
|
2011-11-18 12:46:46 +00:00
|
|
|
gst_queue2_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
|
2007-06-06 13:36:26 +00:00
|
|
|
{
|
|
|
|
gboolean result;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2011-11-18 12:46:46 +00:00
|
|
|
queue = GST_QUEUE2 (parent);
|
2007-06-06 13:36:26 +00:00
|
|
|
|
|
|
|
if (active) {
|
2010-10-11 16:10:07 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
/* open the temp file now */
|
|
|
|
result = gst_queue2_open_temp_location_file (queue);
|
|
|
|
} else if (!queue->ring_buffer) {
|
2010-08-13 14:19:36 +00:00
|
|
|
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
|
2011-04-07 18:44:44 +00:00
|
|
|
result = ! !queue->ring_buffer;
|
2010-08-13 14:19:36 +00:00
|
|
|
} else {
|
|
|
|
result = TRUE;
|
2010-06-18 15:43:40 +00:00
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "activating pull mode");
|
2010-06-28 15:50:06 +00:00
|
|
|
init_ranges (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2007-09-17 16:22:17 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2010-10-31 19:47:25 +00:00
|
|
|
queue->upstream_size = 0;
|
2007-06-06 13:36:26 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue, "no temp file, cannot activate pull mode");
|
|
|
|
/* this is not allowed, we cannot operate in pull mode without a temp
|
|
|
|
* file. */
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
2007-06-06 13:36:26 +00:00
|
|
|
result = FALSE;
|
|
|
|
}
|
2011-08-12 18:27:21 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
} else {
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "deactivating pull mode");
|
2012-02-08 14:16:46 +00:00
|
|
|
queue->srcresult = GST_FLOW_FLUSHING;
|
|
|
|
queue->sinkresult = GST_FLOW_FLUSHING;
|
2007-06-06 13:36:26 +00:00
|
|
|
/* this will unlock getrange */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
result = TRUE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-11-21 12:29:05 +00:00
|
|
|
static gboolean
|
|
|
|
gst_queue2_src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
|
|
|
|
gboolean active)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case GST_PAD_MODE_PULL:
|
|
|
|
res = gst_queue2_src_activate_pull (pad, parent, active);
|
|
|
|
break;
|
|
|
|
case GST_PAD_MODE_PUSH:
|
|
|
|
res = gst_queue2_src_activate_push (pad, parent, active);
|
|
|
|
break;
|
|
|
|
default:
|
2011-11-21 17:56:19 +00:00
|
|
|
GST_LOG_OBJECT (pad, "unknown activation mode %d", mode);
|
2011-11-21 12:29:05 +00:00
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static GstStateChangeReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_change_state (GstElement * element, GstStateChange transition)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (element);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (!gst_queue2_open_temp_location_file (queue))
|
|
|
|
ret = GST_STATE_CHANGE_FAILURE;
|
|
|
|
} else {
|
|
|
|
if (queue->ring_buffer) {
|
2010-08-13 14:19:36 +00:00
|
|
|
g_free (queue->ring_buffer);
|
2010-06-18 15:43:40 +00:00
|
|
|
queue->ring_buffer = NULL;
|
|
|
|
}
|
2010-08-13 14:19:36 +00:00
|
|
|
if (!(queue->ring_buffer = g_malloc (queue->ring_buffer_max_size)))
|
2010-06-18 15:43:40 +00:00
|
|
|
ret = GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
|
|
|
init_ranges (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
queue->segment_event_received = FALSE;
|
|
|
|
queue->starting_segment = NULL;
|
2012-01-27 11:33:32 +00:00
|
|
|
gst_event_replace (&queue->stream_start_event, NULL);
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2020-05-26 17:41:37 +00:00
|
|
|
|
|
|
|
/* Mark the srcpad as reconfigured to trigger querying
|
|
|
|
* the downstream bitrate next time it tries to push */
|
|
|
|
gst_pad_mark_reconfigure (queue->srcpad);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-06-13 14:31:21 +00:00
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
2010-06-13 14:31:21 +00:00
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2010-06-18 15:43:40 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
gst_queue2_close_temp_location_file (queue);
|
|
|
|
} else if (queue->ring_buffer) {
|
2010-08-13 14:19:36 +00:00
|
|
|
g_free (queue->ring_buffer);
|
2010-06-18 15:43:40 +00:00
|
|
|
queue->ring_buffer = NULL;
|
|
|
|
}
|
2011-04-07 18:44:44 +00:00
|
|
|
clean_ranges (queue);
|
2010-06-18 15:43:40 +00:00
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
if (queue->starting_segment != NULL) {
|
|
|
|
gst_event_unref (queue->starting_segment);
|
|
|
|
queue->starting_segment = NULL;
|
|
|
|
}
|
2012-01-27 11:33:32 +00:00
|
|
|
gst_event_replace (&queue->stream_start_event, NULL);
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* changing the capacity of the queue must wake up
|
|
|
|
* the _chain function, it might have more room now
|
|
|
|
* to store the buffer/event in the queue */
|
2013-08-16 10:54:38 +00:00
|
|
|
#define QUEUE_CAPACITY_CHANGE(q) \
|
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue); \
|
|
|
|
if (queue->use_buffering) \
|
|
|
|
update_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* Changing the minimum required fill level must
|
|
|
|
* wake up the _loop function as it might now
|
|
|
|
* be able to preceed.
|
|
|
|
*/
|
|
|
|
#define QUEUE_THRESHOLD_CHANGE(q)\
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2008-06-24 16:22:45 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_set_temp_template (GstQueue2 * queue, const gchar * template)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GstState state;
|
|
|
|
|
|
|
|
/* the element must be stopped in order to do this */
|
|
|
|
GST_OBJECT_LOCK (queue);
|
|
|
|
state = GST_STATE (queue);
|
|
|
|
if (state != GST_STATE_READY && state != GST_STATE_NULL)
|
|
|
|
goto wrong_state;
|
|
|
|
GST_OBJECT_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* set new location */
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (queue->temp_template);
|
|
|
|
queue->temp_template = g_strdup (template);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2008-06-24 16:22:45 +00:00
|
|
|
return;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
/* ERROR */
|
|
|
|
wrong_state:
|
|
|
|
{
|
2009-07-10 18:49:46 +00:00
|
|
|
GST_WARNING_OBJECT (queue, "setting temp-template property in wrong state");
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
GST_OBJECT_UNLOCK (queue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_set_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* someone could change levels here, and since this
|
|
|
|
* affects the get/put funcs, we need to lock for safety. */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_MAX_SIZE_BYTES:
|
|
|
|
queue->max_level.bytes = g_value_get_uint (value);
|
|
|
|
QUEUE_CAPACITY_CHANGE (queue);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_BUFFERS:
|
|
|
|
queue->max_level.buffers = g_value_get_uint (value);
|
|
|
|
QUEUE_CAPACITY_CHANGE (queue);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_TIME:
|
|
|
|
queue->max_level.time = g_value_get_uint64 (value);
|
|
|
|
/* set rate_time to the same value. We use an extra field in the level
|
|
|
|
* structure so that we can easily access and compare it */
|
|
|
|
queue->max_level.rate_time = queue->max_level.time;
|
|
|
|
QUEUE_CAPACITY_CHANGE (queue);
|
|
|
|
break;
|
|
|
|
case PROP_USE_BUFFERING:
|
|
|
|
queue->use_buffering = g_value_get_boolean (value);
|
2014-03-10 13:00:28 +00:00
|
|
|
if (!queue->use_buffering && queue->is_buffering) {
|
|
|
|
GST_DEBUG_OBJECT (queue, "Disabled buffering while buffering, "
|
|
|
|
"posting 100%% message");
|
2014-09-19 15:02:46 +00:00
|
|
|
SET_PERCENT (queue, 100);
|
2014-03-10 13:00:28 +00:00
|
|
|
queue->is_buffering = FALSE;
|
|
|
|
}
|
2014-03-19 08:33:53 +00:00
|
|
|
|
|
|
|
if (queue->use_buffering) {
|
|
|
|
queue->is_buffering = TRUE;
|
|
|
|
update_buffering (queue);
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2015-11-11 14:14:34 +00:00
|
|
|
case PROP_USE_TAGS_BITRATE:
|
|
|
|
queue->use_tags_bitrate = g_value_get_boolean (value);
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
case PROP_USE_RATE_ESTIMATE:
|
|
|
|
queue->use_rate_estimate = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_LOW_PERCENT:
|
2016-08-03 13:20:20 +00:00
|
|
|
queue->low_watermark = g_value_get_int (value) * BUF_LEVEL_PERCENT_FACTOR;
|
2016-09-11 13:26:26 +00:00
|
|
|
if (queue->is_buffering)
|
|
|
|
update_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case PROP_HIGH_PERCENT:
|
2016-08-03 13:20:20 +00:00
|
|
|
queue->high_watermark =
|
|
|
|
g_value_get_int (value) * BUF_LEVEL_PERCENT_FACTOR;
|
2016-09-11 13:26:26 +00:00
|
|
|
if (queue->is_buffering)
|
|
|
|
update_buffering (queue);
|
2016-08-03 13:20:20 +00:00
|
|
|
break;
|
|
|
|
case PROP_LOW_WATERMARK:
|
|
|
|
queue->low_watermark = g_value_get_double (value) * MAX_BUFFERING_LEVEL;
|
2016-09-11 13:26:26 +00:00
|
|
|
if (queue->is_buffering)
|
|
|
|
update_buffering (queue);
|
2016-08-03 13:20:20 +00:00
|
|
|
break;
|
|
|
|
case PROP_HIGH_WATERMARK:
|
|
|
|
queue->high_watermark = g_value_get_double (value) * MAX_BUFFERING_LEVEL;
|
2016-09-11 13:26:26 +00:00
|
|
|
if (queue->is_buffering)
|
|
|
|
update_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2009-07-10 18:49:46 +00:00
|
|
|
case PROP_TEMP_TEMPLATE:
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_set_temp_template (queue, g_value_get_string (value));
|
2009-07-10 18:49:46 +00:00
|
|
|
break;
|
2010-01-22 16:55:39 +00:00
|
|
|
case PROP_TEMP_REMOVE:
|
|
|
|
queue->temp_remove = g_value_get_boolean (value);
|
|
|
|
break;
|
2010-05-05 08:21:55 +00:00
|
|
|
case PROP_RING_BUFFER_MAX_SIZE:
|
2010-06-16 10:24:25 +00:00
|
|
|
queue->ring_buffer_max_size = g_value_get_uint64 (value);
|
2010-05-05 08:21:55 +00:00
|
|
|
break;
|
2018-05-17 11:42:43 +00:00
|
|
|
case PROP_USE_BITRATE_QUERY:
|
|
|
|
queue->use_bitrate_query = g_value_get_boolean (value);
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2014-09-19 15:02:46 +00:00
|
|
|
gst_queue2_post_buffering (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_get_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_CUR_LEVEL_BYTES:
|
|
|
|
g_value_set_uint (value, queue->cur_level.bytes);
|
|
|
|
break;
|
|
|
|
case PROP_CUR_LEVEL_BUFFERS:
|
|
|
|
g_value_set_uint (value, queue->cur_level.buffers);
|
|
|
|
break;
|
|
|
|
case PROP_CUR_LEVEL_TIME:
|
|
|
|
g_value_set_uint64 (value, queue->cur_level.time);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_BYTES:
|
|
|
|
g_value_set_uint (value, queue->max_level.bytes);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_BUFFERS:
|
|
|
|
g_value_set_uint (value, queue->max_level.buffers);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_TIME:
|
|
|
|
g_value_set_uint64 (value, queue->max_level.time);
|
|
|
|
break;
|
|
|
|
case PROP_USE_BUFFERING:
|
|
|
|
g_value_set_boolean (value, queue->use_buffering);
|
|
|
|
break;
|
2015-11-11 14:14:34 +00:00
|
|
|
case PROP_USE_TAGS_BITRATE:
|
|
|
|
g_value_set_boolean (value, queue->use_tags_bitrate);
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
case PROP_USE_RATE_ESTIMATE:
|
|
|
|
g_value_set_boolean (value, queue->use_rate_estimate);
|
|
|
|
break;
|
|
|
|
case PROP_LOW_PERCENT:
|
2016-08-03 13:20:20 +00:00
|
|
|
g_value_set_int (value, queue->low_watermark / BUF_LEVEL_PERCENT_FACTOR);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case PROP_HIGH_PERCENT:
|
2016-08-03 13:20:20 +00:00
|
|
|
g_value_set_int (value, queue->high_watermark / BUF_LEVEL_PERCENT_FACTOR);
|
|
|
|
break;
|
|
|
|
case PROP_LOW_WATERMARK:
|
|
|
|
g_value_set_double (value, queue->low_watermark /
|
|
|
|
(gdouble) MAX_BUFFERING_LEVEL);
|
|
|
|
break;
|
|
|
|
case PROP_HIGH_WATERMARK:
|
|
|
|
g_value_set_double (value, queue->high_watermark /
|
|
|
|
(gdouble) MAX_BUFFERING_LEVEL);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2009-07-10 18:49:46 +00:00
|
|
|
case PROP_TEMP_TEMPLATE:
|
|
|
|
g_value_set_string (value, queue->temp_template);
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
case PROP_TEMP_LOCATION:
|
|
|
|
g_value_set_string (value, queue->temp_location);
|
|
|
|
break;
|
2010-01-22 16:55:39 +00:00
|
|
|
case PROP_TEMP_REMOVE:
|
|
|
|
g_value_set_boolean (value, queue->temp_remove);
|
|
|
|
break;
|
2010-05-05 08:21:55 +00:00
|
|
|
case PROP_RING_BUFFER_MAX_SIZE:
|
2010-06-16 10:24:25 +00:00
|
|
|
g_value_set_uint64 (value, queue->ring_buffer_max_size);
|
2010-05-05 08:21:55 +00:00
|
|
|
break;
|
2015-02-23 03:16:19 +00:00
|
|
|
case PROP_AVG_IN_RATE:
|
|
|
|
{
|
|
|
|
gdouble in_rate = queue->byte_in_rate;
|
|
|
|
|
|
|
|
/* During the first RATE_INTERVAL, byte_in_rate will not have been
|
|
|
|
* calculated, so calculate it here. */
|
|
|
|
if (in_rate == 0.0 && queue->bytes_in
|
|
|
|
&& queue->last_update_in_rates_elapsed > 0.0)
|
|
|
|
in_rate = queue->bytes_in / queue->last_update_in_rates_elapsed;
|
|
|
|
|
|
|
|
g_value_set_int64 (value, (gint64) in_rate);
|
|
|
|
break;
|
|
|
|
}
|
2018-05-17 11:42:43 +00:00
|
|
|
case PROP_USE_BITRATE_QUERY:
|
|
|
|
g_value_set_boolean (value, queue->use_bitrate_query);
|
|
|
|
break;
|
|
|
|
case PROP_BITRATE:{
|
|
|
|
guint64 bitrate = 0;
|
|
|
|
if (bitrate == 0 && queue->use_tags_bitrate) {
|
|
|
|
if (queue->sink_tags_bitrate > 0)
|
|
|
|
bitrate = queue->sink_tags_bitrate;
|
|
|
|
else if (queue->src_tags_bitrate)
|
|
|
|
bitrate = queue->src_tags_bitrate;
|
|
|
|
}
|
|
|
|
if (bitrate == 0 && queue->use_bitrate_query) {
|
|
|
|
bitrate = queue->downstream_bitrate;
|
|
|
|
}
|
|
|
|
g_value_set_uint64 (value, (guint64) bitrate);
|
|
|
|
break;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|