Skip to content

Commit ee161c6

Browse files
committed
feat: release version 0.6.0 with url parsing fixes and tests
1 parent 377f312 commit ee161c6

25 files changed

Lines changed: 2498 additions & 56 deletions

.github/workflows/ci.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,27 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
sdk: ['stable']
14+
sdk: ["stable"]
1515
steps:
1616
- uses: actions/checkout@v4
17-
17+
1818
- name: Setup Dart
1919
uses: dart-lang/setup-dart@v1
2020
with:
2121
sdk: ${{ matrix.sdk }}
22-
22+
2323
- name: Cache pub cache
2424
uses: actions/cache@v3
2525
with:
2626
path: ~/.pub-cache
2727
key: ${{ runner.os }}-pubcache-${{ hashFiles('**/pubspec.lock') }}
2828
restore-keys: ${{ runner.os }}-pubcache-
29-
29+
3030
- name: Get dependencies
3131
run: dart pub get
32-
33-
- name: Check formatting
34-
run: dart format --output=none --set-exit-if-changed .
35-
32+
3633
- name: Run static analysis
3734
run: dart analyze
38-
35+
3936
- name: Run tests
4037
run: dart test

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 0.6.0
2+
3+
- **Fixed**: `RangeTokenizer.hasCompleteData` now reports `true` when the entire remote file fits inside the initial header fetch.
4+
- **Fixed**: `ProbingRangeTokenizer` now aligns `mp4Optimized` tail fetches to chunk boundaries, preventing chunk-cache misindexing near the end of large MP4/M4A files.
5+
- **Added**: Real URL integration coverage for MP3, FLAC, OGG, M4B, plus 600+ MB FLAC and WAV files.
6+
- **Added**: Lower-level tokenizer smoke tests for FLAC, AIFF, M4A, and WAV sample files.
7+
18
## 0.5.1
29

310
- **Fixed**: `ProbingRangeTokenizer` now correctly splits fetched data into 64KB chunks, fixing metadata parsing failures for MP3 files with large ID3v2 headers when using `ParseStrategy.probe`.

lib/src/mpeg/mpeg_parser.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,20 @@ class MpegParser {
424424
if (sampleRate != null && metadata.format.duration == null) {
425425
metadata.setFormat(duration: numberOfSamples / sampleRate);
426426
}
427+
} else if (metadata.format.duration == null &&
428+
!tokenizer.hasCompleteData &&
429+
_bitrates.isNotEmpty &&
430+
mpegSize > 0) {
431+
// For VBR files without a Xing/LAME header, parsed from a URL with
432+
// only partial data available, the frame-counting fallback would only
433+
// see a tiny fraction of the file and give a grossly incorrect duration.
434+
// Instead, estimate duration from the known file size and the average
435+
// bitrate sampled from the frames we did parse.
436+
final averageBitrate =
437+
_bitrates.reduce((a, b) => a + b) / _bitrates.length;
438+
if (averageBitrate > 0) {
439+
metadata.setFormat(duration: mpegSize * 8 / averageBitrate);
440+
}
427441
}
428442

429443
final profile = metadata.format.codecProfile;

0 commit comments

Comments
 (0)