mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
playbin: Add simple 'raw decoding mode'.
Raw decoding mode removes almost all buffering in video and audio queues when a source providing already decoded video/audio is detected, on the possibly bogus assumption that such a source should provide sufficient internal queueing. Fixes playback on some DVDs, and improves it on all.
This commit is contained in:
parent
df660e91c2
commit
c2a56e3115
2 changed files with 19 additions and 4 deletions
|
@ -826,10 +826,22 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
|
||||||
* after the source that measures the datarate and scales this
|
* after the source that measures the datarate and scales this
|
||||||
* queue of encoded data instead.
|
* queue of encoded data instead.
|
||||||
*/
|
*/
|
||||||
|
if (play_base_bin->raw_decoding_mode) {
|
||||||
|
if (type == GST_STREAM_TYPE_VIDEO) {
|
||||||
|
g_object_set (G_OBJECT (preroll),
|
||||||
|
"max-size-buffers", 2, "max-size-bytes", 0,
|
||||||
|
"max-size-time", (guint64) 0, NULL);
|
||||||
|
} else {
|
||||||
|
g_object_set (G_OBJECT (preroll),
|
||||||
|
"max-size-buffers", 0, "max-size-bytes",
|
||||||
|
2 * 1024 * 1024, "max-size-time", play_base_bin->queue_size, NULL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
g_object_set (G_OBJECT (preroll),
|
g_object_set (G_OBJECT (preroll),
|
||||||
"max-size-buffers", 0, "max-size-bytes",
|
"max-size-buffers", 0, "max-size-bytes",
|
||||||
((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024,
|
((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024,
|
||||||
"max-size-time", play_base_bin->queue_size, NULL);
|
"max-size-time", play_base_bin->queue_size, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* the overrun signal is always attached and serves two purposes:
|
/* the overrun signal is always attached and serves two purposes:
|
||||||
*
|
*
|
||||||
|
@ -1697,6 +1709,7 @@ source_new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin)
|
||||||
GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element));
|
GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element));
|
||||||
|
|
||||||
/* if this is a pad with all raw caps, we can expose it */
|
/* if this is a pad with all raw caps, we can expose it */
|
||||||
|
bin->raw_decoding_mode = TRUE;
|
||||||
if (has_all_raw_caps (pad, &is_raw) && is_raw) {
|
if (has_all_raw_caps (pad, &is_raw) && is_raw) {
|
||||||
/* it's all raw, create output pads. */
|
/* it's all raw, create output pads. */
|
||||||
new_decoded_pad_full (element, pad, FALSE, bin, FALSE);
|
new_decoded_pad_full (element, pad, FALSE, bin, FALSE);
|
||||||
|
@ -2066,6 +2079,7 @@ setup_source (GstPlayBaseBin * play_base_bin)
|
||||||
|
|
||||||
if (!play_base_bin->need_rebuild)
|
if (!play_base_bin->need_rebuild)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
play_base_bin->raw_decoding_mode = FALSE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (play_base_bin, "setup source");
|
GST_DEBUG_OBJECT (play_base_bin, "setup source");
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct _GstPlayBaseBin {
|
||||||
GstElement *subtitle; /* additional filesrc ! subparse bin */
|
GstElement *subtitle; /* additional filesrc ! subparse bin */
|
||||||
gboolean subtitle_done;
|
gboolean subtitle_done;
|
||||||
gboolean need_rebuild;
|
gboolean need_rebuild;
|
||||||
|
gboolean raw_decoding_mode; /* Use smaller queues when source outputs raw data */
|
||||||
|
|
||||||
GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */
|
GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */
|
||||||
gchar *subencoding; /* encoding to propagate to the above subtitle elements */
|
gchar *subencoding; /* encoding to propagate to the above subtitle elements */
|
||||||
|
|
Loading…
Reference in a new issue