atdec: Set correct number of frames for MP3

This commit is contained in:
Sebastian Dröge 2014-03-11 11:18:22 +01:00
parent 2d8b195911
commit 1c13e513c9
3 changed files with 9 additions and 4 deletions

View file

@ -225,22 +225,27 @@ gst_caps_to_at_format (GstCaps * caps, AudioStreamBasicDescription * format)
format->mFormatID = kAudioFormatMPEG4AAC;
format->mFramesPerPacket = 1024;
} else if (can_intersect_static_caps (caps, &mp3_caps)) {
gint layer;
gint layer, mpegaudioversion = 1;
gst_structure_get_int (structure, "layer", &layer);
gst_structure_get_int (structure, "mpegaudioversion", &mpegaudioversion);
switch (layer) {
case 1:
format->mFormatID = kAudioFormatMPEGLayer1;
format->mFramesPerPacket = 384;
break;
case 2:
format->mFormatID = kAudioFormatMPEGLayer2;
format->mFramesPerPacket = 1152;
break;
case 3:
format->mFormatID = kAudioFormatMPEGLayer3;
format->mFramesPerPacket = (mpegaudioversion == 1 ? 1152 : 576);
break;
default:
g_warn_if_reached ();
format->mFormatID = kAudioFormatMPEGLayer3;
format->mFramesPerPacket = 1152;
break;
}
} else if (can_intersect_static_caps (caps, &raw_caps)) {