Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dts mpeg2ts update #275

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reduce the number of bytes read from bitstream buffer to extract the …
…UHD header size. Update comments in the time stamp extraction code.
  • Loading branch information
rahulmohan-xperi committed Dec 6, 2023
commit b8f0350ddbb50c6d74b758c99d40d9d674c61009
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ public static DtsAudioFormat parseDtsUhdFormat(byte[] frame, AtomicInteger uhdAu
/* cause= */ null);
}
rohitjoins marked this conversation as resolved.
Show resolved Hide resolved
// Skip time stamp information if present, see section 5.2.3.2.
if (frameBits.readBit()) { // m_TimeStamp.m_bUpdateFlag
if (frameBits.readBit()) { // m_bParamPresent
// m_bUpdateFlag == true as m_bSyncFramePredefValueExists is false.
frameBits.skipBits(32 + 4); // m_TimeStamp
}
int sampleRateMultiplier = (1 << frameBits.readBits(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ public void consume(ParsableByteArray data) throws ParserException {
break;
case STATE_FINDING_UHD_HEADER_SIZE:
// Read enough bytes to parse the header size information.
if (continueRead(data, headerScratchBytes.getData(), /* targetLength= */ 7)) {
if (continueRead(data, headerScratchBytes.getData(), /* targetLength= */ 6)) {
uhdHeaderSize = DtsUtil.parseDtsUhdHeaderSize(headerScratchBytes.getData());
// If data read(FTOC_MIN_HEADER_SIZE) is more than the actual header size, set target
// read length equal to bytesRead. Otherwise the continueRead() function will fail.
uhdHeaderSize = max(bytesRead, uhdHeaderSize);
// Adjust the array read position if data read is more than the actual header size.
rohitjoins marked this conversation as resolved.
Show resolved Hide resolved
if (bytesRead > uhdHeaderSize) {
int extraBytes = bytesRead - uhdHeaderSize;
bytesRead -= extraBytes;
data.setPosition(data.getPosition() - extraBytes);
}
state = STATE_READING_UHD_HEADER;
}
break;
Expand Down