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

fix: make mfro search return silently if not present #271

Merged
merged 1 commit into from
Sep 22, 2023
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet

## [0.38.1] - 2023-09-22

### Fixed
- ReadMP4File() failed when mfro not present

## [0.38.0] - 2023-09-06

### Added
Expand Down Expand Up @@ -436,7 +443,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- New unique repo name: `mp4ff`

[Unreleased]: https://github.com/Eyevinn/mp4ff/compare/v0.38.0...HEAD
[Unreleased]: https://github.com/Eyevinn/mp4ff/compare/v0.38.1...HEAD
[0.38.1]: https://github.com/Eyevinn/mp4ff/compare/v0.37.0...v0.38.0
[0.38.0]: https://github.com/Eyevinn/mp4ff/compare/v0.37.0...v0.38.0
[0.37.0]: https://github.com/Eyevinn/mp4ff/compare/v0.36.0...v0.37.0
[0.36.0]: https://github.com/Eyevinn/mp4ff/compare/v0.35.0...v0.36.0
Expand Down
5 changes: 4 additions & 1 deletion mp4/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ func (f *File) startSegmentIfNeeded(b Box, boxStartPos uint64) {
}

// findAndReadMfra tries to find a tfra box inside an mfra box at the end of the file
// If no mfro box is found, no error is reported.
func (f *File) findAndReadMfra(r io.Reader) error {
rs, ok := r.(io.ReadSeeker)
if !ok {
Expand All @@ -338,7 +339,9 @@ func (f *File) findAndReadMfra(r io.Reader) error {
}
b, err := DecodeBox(uint64(pos), rs) // mfro
if err != nil {
return fmt.Errorf("could not decode mfro box: %w", err)
// Not an mfro box here, just reset and return
_, err = rs.Seek(0, io.SeekStart)
return err
}
mfro, ok := b.(*MfroBox)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion mp4/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func TestGetSegmentBoundariesFromSidx(t *testing.T) {
t.Error(err)
}

parsedFile, err := DecodeFile(file)
parsedFile, err := DecodeFile(file, WithDecodeFlags(DecISMFlag))
if err != nil {
t.Error(err)
}
Expand Down
Loading