qtdemux: Try to infer useful header values for raw audio if the sound sample descriptions contain zero values

This commit is contained in:
Sebastian Dröge 2020-02-28 14:23:51 +02:00 committed by GStreamer Merge Bot
parent 9e9af6711d
commit 885d330ee6

View file

@ -12163,6 +12163,33 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
break;
}
/* fix up any invalid header information from above */
case FOURCC_twos:
case FOURCC_sowt:
case FOURCC_raw_:
case FOURCC_lpcm:
/* Sometimes these are set to 0 in the sound sample descriptions so
* let's try to infer useful values from the other information we
* have available */
if (entry->bytes_per_sample == 0)
entry->bytes_per_sample =
entry->bytes_per_frame / entry->n_channels;
if (entry->bytes_per_sample == 0)
entry->bytes_per_sample = samplesize / 8;
if (entry->bytes_per_frame == 0)
entry->bytes_per_frame =
entry->bytes_per_sample * entry->n_channels;
if (entry->bytes_per_packet == 0)
entry->bytes_per_packet = entry->bytes_per_sample;
if (entry->samples_per_frame == 0)
entry->samples_per_frame = entry->n_channels;
if (entry->samples_per_packet == 0)
entry->samples_per_packet = entry->samples_per_frame;
break;
case FOURCC_in24:
case FOURCC_in32:
case FOURCC_fl32: