mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-05 11:37:49 +00:00
typefind: bump probability if all frames we found are similar
Similar meaning same layer, same bitrate, and same number of channels This fixes misdetection of (some MP3 files that have zero padding between the ID3 tag and the MP3 stream) as H.264 video. https://bugzilla.gnome.org/show_bug.cgi?id=656018
This commit is contained in:
parent
c87f164eff
commit
fa3e246866
1 changed files with 5 additions and 0 deletions
|
@ -1014,6 +1014,7 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
|
||||||
guint layer = 0, bitrate, samplerate, channels;
|
guint layer = 0, bitrate, samplerate, channels;
|
||||||
guint found = 0; /* number of valid headers found */
|
guint found = 0; /* number of valid headers found */
|
||||||
guint64 offset = skipped;
|
guint64 offset = skipped;
|
||||||
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
while (found < GST_MP3_TYPEFIND_TRY_HEADERS) {
|
while (found < GST_MP3_TYPEFIND_TRY_HEADERS) {
|
||||||
guint32 head;
|
guint32 head;
|
||||||
|
@ -1064,6 +1065,8 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
|
||||||
* that this is not a mp3 but just a random bytestream. It could
|
* that this is not a mp3 but just a random bytestream. It could
|
||||||
* be a freaking funky encoded mp3 though. We'll just not count
|
* be a freaking funky encoded mp3 though. We'll just not count
|
||||||
* this header*/
|
* this header*/
|
||||||
|
if (prev_layer)
|
||||||
|
changed = TRUE;
|
||||||
prev_layer = layer;
|
prev_layer = layer;
|
||||||
prev_channels = channels;
|
prev_channels = channels;
|
||||||
prev_samplerate = samplerate;
|
prev_samplerate = samplerate;
|
||||||
|
@ -1094,6 +1097,8 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
|
||||||
probability = GST_TYPE_FIND_MINIMUM;
|
probability = GST_TYPE_FIND_MINIMUM;
|
||||||
if (start_off > 0)
|
if (start_off > 0)
|
||||||
probability /= 2;
|
probability /= 2;
|
||||||
|
if (!changed)
|
||||||
|
probability = (probability + GST_TYPE_FIND_MAXIMUM) / 2;
|
||||||
|
|
||||||
GST_INFO
|
GST_INFO
|
||||||
("audio/mpeg calculated %u = %u * %u / %u * (%u - %"
|
("audio/mpeg calculated %u = %u * %u / %u * (%u - %"
|
||||||
|
|
Loading…
Reference in a new issue