Skip to content

Commit

Permalink
Rollback of 76df06a
Browse files Browse the repository at this point in the history
*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

PiperOrigin-RevId: 490570517
  • Loading branch information
rohitjoins authored and icbaker committed Nov 24, 2022
1 parent 7d45b9d commit 4273291
Show file tree
Hide file tree
Showing 31 changed files with 1 addition and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,13 @@ public static Format parseAc3AnnexFFormat(
if ((nextByte & 0x04) != 0) { // lfeon
channelCount++;
}
// bit_rate_code - 5 bits. 2 bits from previous byte and 3 bits from next.
int halfFrmsizecod = ((nextByte & 0x03) << 3) | ((data.readUnsignedByte() & 0xE0) >> 5);
int constantBitrate = BITRATE_BY_HALF_FRMSIZECOD[halfFrmsizecod];
return new Format.Builder()
.setId(trackId)
.setSampleMimeType(MimeTypes.AUDIO_AC3)
.setChannelCount(channelCount)
.setSampleRate(sampleRate)
.setDrmInitData(drmInitData)
.setLanguage(language)
.setAverageBitrate(constantBitrate)
.setPeakBitrate(constantBitrate)
.build();
}

Expand All @@ -185,9 +180,7 @@ public static Format parseAc3AnnexFFormat(
*/
public static Format parseEAc3AnnexFFormat(
ParsableByteArray data, String trackId, String language, @Nullable DrmInitData drmInitData) {
// 13 bits for data_rate, 3 bits for num_ind_sub which are ignored.
int peakBitrate =
((data.readUnsignedByte() & 0xFF) << 5) | ((data.readUnsignedByte() & 0xF8) >> 3);
data.skipBytes(2); // data_rate, num_ind_sub

// Read the first independent substream.
int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
Expand Down Expand Up @@ -223,7 +216,6 @@ public static Format parseEAc3AnnexFFormat(
.setSampleRate(sampleRate)
.setDrmInitData(drmInitData)
.setLanguage(language)
.setPeakBitrate(peakBitrate)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 13824
sample count = 9
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
maxInputSize = 1566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 9216
sample count = 6
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
maxInputSize = 1566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 4608
sample count = 3
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
maxInputSize = 1566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 1536
sample count = 1
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
maxInputSize = 1566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 13824
sample count = 9
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
maxInputSize = 1566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 13824
sample count = 9
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 10752
sample count = 7
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 6144
sample count = 4
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 1536
sample count = 1
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ track 0:
total output bytes = 13824
sample count = 9
format 0:
averageBitrate = 384
peakBitrate = 384
id = 1
sampleMimeType = audio/ac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 216000
sample count = 54
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
maxInputSize = 4030
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 144000
sample count = 36
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
maxInputSize = 4030
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 72000
sample count = 18
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
maxInputSize = 4030
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 4000
sample count = 1
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
maxInputSize = 4030
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 216000
sample count = 54
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
maxInputSize = 4030
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 216000
sample count = 54
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 148000
sample count = 37
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 76000
sample count = 19
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 4000
sample count = 1
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 216000
sample count = 54
format 0:
peakBitrate = 1000
id = 1
sampleMimeType = audio/eac3
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 163840
sample count = 64
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
maxInputSize = 2590
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 110080
sample count = 43
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
maxInputSize = 2590
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 56320
sample count = 22
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
maxInputSize = 2590
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 2560
sample count = 1
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
maxInputSize = 2590
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 163840
sample count = 64
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
maxInputSize = 2590
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 163840
sample count = 64
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 110080
sample count = 43
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 56320
sample count = 22
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 2560
sample count = 1
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
channelCount = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ track 0:
total output bytes = 163840
sample count = 64
format 0:
peakBitrate = 640
id = 1
sampleMimeType = audio/eac3-joc
channelCount = 6
Expand Down

0 comments on commit 4273291

Please sign in to comment.