commit a9f53c38cd4bba696bdb51a4687d71a46ad885c0
parent a9ce3d5f0c7a493ab94c724f1a60021f4bdb0533
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 27 Mar 2012 14:00:09 +0000
LRN: This should fix that.
It rises the valid/invalid threshold to 0.8 (from 0.5), the total
frame count threshold - to 3 (from 2), and minimal frame size - to 8
(from 0).
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/plugins/mp3_extractor.c b/src/plugins/mp3_extractor.c
@@ -208,8 +208,8 @@ calculate_frame_statistics_and_maybe_report_it (struct EXTRACTOR_PluginList *plu
int length;
char format[512];
- if (((double) state->number_of_valid_frames / (double) state->number_of_frames) < 0.5 ||
- state->number_of_valid_frames < 2)
+ if (((double) state->number_of_valid_frames / (double) state->number_of_frames) < 0.8 ||
+ state->number_of_valid_frames <= 2)
/* Unlikely to be an mp3 file */
return 0;
ADDR ("audio/mpeg", EXTRACTOR_METATYPE_MIMETYPE);
@@ -297,7 +297,7 @@ EXTRACTOR_mp3_extract_method (struct EXTRACTOR_PluginList *plugin,
if (offset + sizeof (state->header) >= size)
{
/* Alternative: (frames_found_in_this_round < (size / LARGEST_FRAME_SIZE / 2)) is to generous */
- if ((file_position == 0 && ((double) state->number_of_valid_frames / (double) state->number_of_frames) < 0.5) ||
+ if ((file_position == 0 && (state->number_of_valid_frames > 2) && ((double) state->number_of_valid_frames / (double) state->number_of_frames) < 0.8) ||
file_position + offset + sizeof (state->header) >= file_size)
{
calculate_frame_statistics_and_maybe_report_it (plugin, state, proc, proc_cls);
@@ -384,7 +384,7 @@ EXTRACTOR_mp3_extract_method (struct EXTRACTOR_PluginList *plugin,
frame_size = (12 * bitrate / sample_rate + ((state->header >> MPA_PADDING_SHIFT) & 0x1)) * 4;
else
frame_size = 144 * bitrate / sample_rate + ((state->header >> MPA_PADDING_SHIFT) & 0x1);
- if (frame_size <= 0)
+ if (frame_size < 8)
{
/*error in header */
state->state = MP3_LOOKING_FOR_FRAME;