mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 17:52:29 +00:00
flacparse: ensure we only check for sample/block mixup at start
Otherwise we might trigger at some point within the file, but the check is only making sense for the second block.
This commit is contained in:
parent
3e2b23280e
commit
0249a73a3e
2 changed files with 12 additions and 5 deletions
|
@ -328,6 +328,7 @@ gst_flac_parse_start (GstBaseParse * parse)
|
|||
flacparse->blocking_strategy = 0;
|
||||
flacparse->block_size = 0;
|
||||
flacparse->sample_number = 0;
|
||||
flacparse->strategy_checked = FALSE;
|
||||
|
||||
/* "fLaC" marker */
|
||||
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 4);
|
||||
|
@ -538,11 +539,16 @@ gst_flac_parse_frame_header_is_valid (GstFlacParse * flacparse,
|
|||
/* Sanity check sample number against blocking strategy, as it seems
|
||||
some files claim fixed block size but supply sample numbers,
|
||||
rather than block numbers. */
|
||||
if (set && blocking_strategy == 0 && block_size == sample_number) {
|
||||
GST_WARNING_OBJECT (flacparse, "This file claims fixed block size, "
|
||||
"but seems to be lying: assuming variable block size");
|
||||
flacparse->force_variable_block_size = TRUE;
|
||||
blocking_strategy = 1;
|
||||
if (blocking_strategy == 0 && flacparse->block_size != 0) {
|
||||
if (!flacparse->strategy_checked) {
|
||||
if (block_size == sample_number) {
|
||||
GST_WARNING_OBJECT (flacparse, "This file claims fixed block size, "
|
||||
"but seems to be lying: assuming variable block size");
|
||||
flacparse->force_variable_block_size = TRUE;
|
||||
blocking_strategy = 1;
|
||||
}
|
||||
flacparse->strategy_checked = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -74,6 +74,7 @@ struct _GstFlacParse {
|
|||
guint8 blocking_strategy;
|
||||
guint16 block_size;
|
||||
guint64 sample_number;
|
||||
gboolean strategy_checked;
|
||||
|
||||
GstTagList *tags;
|
||||
|
||||
|
|
Loading…
Reference in a new issue