gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20785 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r20785 - Extractor/src/plugins
Date: Tue, 27 Mar 2012 16:00:09 +0200

Author: grothoff
Date: 2012-03-27 16:00:09 +0200 (Tue, 27 Mar 2012)
New Revision: 20785

Modified:
   Extractor/src/plugins/mp3_extractor.c
Log:
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).



Modified: Extractor/src/plugins/mp3_extractor.c
===================================================================
--- Extractor/src/plugins/mp3_extractor.c       2012-03-27 13:41:06 UTC (rev 
20784)
+++ Extractor/src/plugins/mp3_extractor.c       2012-03-27 14:00:09 UTC (rev 
20785)
@@ -208,8 +208,8 @@
   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 @@
       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 @@
         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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]