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:
Vincent Penquerc'h 2011-12-04 12:50:57 +00:00
parent 3e2b23280e
commit 0249a73a3e
2 changed files with 12 additions and 5 deletions

View file

@ -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;
}
}
/*

View file

@ -74,6 +74,7 @@ struct _GstFlacParse {
guint8 blocking_strategy;
guint16 block_size;
guint64 sample_number;
gboolean strategy_checked;
GstTagList *tags;