Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
f461ff67
Commit
f461ff67
authored
Nov 20, 2015
by
Joseph Wallace
Browse files
Buffer clusters to have time to probe them for metadata, like keyframes.
parent
def5a4cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/format_ebml.c
View file @
f461ff67
...
...
@@ -77,6 +77,7 @@ struct ebml_st {
unsigned
long
long
copy_len
;
int
cluster_start
;
int
flush_cluster
;
int
position
;
unsigned
char
*
buffer
;
...
...
@@ -377,8 +378,24 @@ static int ebml_read_space(ebml_t *ebml)
/* return up until just before a new cluster starts */
read_space
=
ebml
->
cluster_start
;
}
else
{
/* return what we have */
read_space
=
ebml
->
position
;
if
(
ebml
->
position
==
EBML_SLICE_SIZE
)
{
/* The current cluster fills the buffer,
* we have no choice but to start flushing it.
*/
ebml
->
flush_cluster
=
1
;
}
if
(
ebml
->
flush_cluster
)
{
/* return what we have */
read_space
=
ebml
->
position
;
}
else
{
/* wait until we've read more, so the parser has
* time to gather metadata
*/
read_space
=
0
;
}
}
return
read_space
;
...
...
@@ -568,6 +585,8 @@ static int ebml_wrote(ebml_t *ebml, int len)
* sync point.
*/
if
(
ebml
->
cluster_start
>=
0
)
{
/* Allow the cluster in the read buffer to flush. */
ebml
->
flush_cluster
=
1
;
processing
=
0
;
}
else
{
...
...
@@ -580,6 +599,9 @@ static int ebml_wrote(ebml_t *ebml, int len)
/* Mark this sync point */
ebml
->
cluster_start
=
ebml
->
position
;
/* Buffer data to give us time to probe for keyframes, etc. */
ebml
->
flush_cluster
=
0
;
/* Copy cluster tag to read buffer */
ebml
->
copy_len
=
tag_length
;
ebml
->
parse_state
=
EBML_STATE_COPYING_TO_DATA
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment