1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/libraries/mp4v2/A01-divide-zero.patch
Wout Mertens d1ebc1a2b3 mp4v2: Add patches from Handbrake project
mp4v2 seems abandoned upstream.

Patches:
- A00: Add API call for subpicture subtitles
- A01: Fix divide by zero
- A02: Give a meaningfull error when hitting 4GB limit
- P00: Fix compilation with mingw32
2014-05-04 01:56:48 +02:00

23 lines
1.1 KiB
Diff

--- mp4v2-r355/src/mp4track.cpp 2012-01-05 15:44:29.000000000 +0100
+++ mp4v2-r355/src/mp4track.cpp 2012-01-05 15:47:34.000000000 +0100
@@ -819,13 +819,14 @@
(thisSecStart + timeScale) - lastSampleTime;
// calculate the duration of the last sample
MP4Duration lastSampleDur = sampleTime - lastSampleTime;
- uint32_t overflow_bytes;
// now, calculate the number of bytes we overflowed. Round up.
- overflow_bytes =
- ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur;
+ if( lastSampleDur > 0 ) {
+ uint32_t overflow_bytes = 0;
+ overflow_bytes = ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur;
- if (bytesThisSec - overflow_bytes > maxBytesPerSec) {
- maxBytesPerSec = bytesThisSec - overflow_bytes;
+ if (bytesThisSec - overflow_bytes > maxBytesPerSec) {
+ maxBytesPerSec = bytesThisSec - overflow_bytes;
+ }
}
// now adjust the values for this sample. Remove the bytes