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

Increase adts.js test coverage to 100% #2053

Merged
merged 2 commits into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions src/demux/adts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* ADTS parser helper
* ADTS parser helper
* @link https://wiki.multimedia.cx/index.php?title=ADTS
*/
import { logger } from '../utils/logger';
import { ErrorTypes, ErrorDetails } from '../errors';
Expand Down Expand Up @@ -160,7 +161,7 @@ export function isHeader (data, offset) {
export function probe (data, offset) {
// same as isHeader but we also check that ADTS frame follows last ADTS frame
// or end of data is reached
if (offset + 1 < data.length && isHeaderPattern(data, offset)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change made?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the function above (it's hidden in the diff, you have to expand it) , you'll see the pre-existing function isHeader that performs the exact same check

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah very good, thanks!

if (isHeader(data, offset)) {
// ADTS header Length
let headerLength = getHeaderLength(data, offset);
// ADTS frame Length
Expand Down
Loading