Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 3cf0d3b

Browse files
author
Alfredo.Yang
committed
Bug 1423469 - update mp4 rust parser. r=kinetik
MozReview-Commit-ID: IMnqoNL2jay --HG-- extra : rebase_source : 14bd23405f9dfdcbb8bae5a850439918aacec5e3
1 parent 677bd49 commit 3cf0d3b

13 files changed

Lines changed: 175 additions & 35 deletions

File tree

media/mp4parse-rust/mp4parse-cargo.patch

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,48 @@ diff --git a/media/libstagefright/binding/mp4parse/Cargo.toml b/media/libstagefr
22
index ff9422c..814c4c6 100644
33
--- a/media/libstagefright/binding/mp4parse/Cargo.toml
44
+++ b/media/libstagefright/binding/mp4parse/Cargo.toml
5-
@@ -20,19 +20,12 @@ exclude = [
5+
@@ -20,18 +20,12 @@ exclude = [
66
]
77

88
-[badges]
99
-travis-ci = { repository = "https://github.com/mozilla/mp4parse-rust" }
1010

1111
[dependencies]
1212
byteorder = "1.0.0"
13-
-afl = { version = "0.1.1", optional = true }
14-
-afl-plugin = { version = "0.1.1", optional = true }
13+
-afl = { version = "0.3", optional = true }
1514
-abort_on_panic = { version = "1.0.0", optional = true }
1615
bitreader = { version = "0.3.0" }
1716
num-traits = "0.1.37"
18-
-mp4parse_fallible = { git = "https://github.com/alfredoyang/mp4parse_fallible", optional = true }
19-
+mp4parse_fallible = { path = "../mp4parse_fallible", optional = true }
17+
mp4parse_fallible = { version = "0.0.1", optional = true }
2018

2119
[dev-dependencies]
2220
test-assembler = "0.1.2"
2321

2422
-[features]
25-
-fuzz = ["afl", "afl-plugin", "abort_on_panic"]
26-
# Somewhat heavy-handed, but we want at least -Z force-overflow-checks=on.
27-
[profile.release]
28-
debug-assertions = true
23+
-fuzz = ["afl", "abort_on_panic"]
2924
diff --git a/media/libstagefright/binding/mp4parse_capi/Cargo.toml b/media/libstagefright/binding/mp4parse_capi/Cargo.toml
3025
index a30e045..a965f06 100644
3126
--- a/media/libstagefright/binding/mp4parse_capi/Cargo.toml
3227
+++ b/media/libstagefright/binding/mp4parse_capi/Cargo.toml
3328
@@ -18,20 +18,13 @@ exclude = [
3429
"*.mp4",
3530
]
36-
31+
3732
-[badges]
3833
-travis-ci = { repository = "https://github.com/mozilla/mp4parse-rust" }
3934
+build = false
40-
35+
4136
[dependencies]
4237
byteorder = "1.0.0"
43-
38+
4439
# To enable fallible memory allocation, add 'features = ["mp4parse_fallible"]'
4540
# in mp4parse brace.
46-
-mp4parse = {version = "0.9.0", path = "../mp4parse"}
47-
+mp4parse = {version = "0.9.0", path = "../mp4parse", features = ["mp4parse_fallible"]}
41+
-mp4parse = {version = "0.9.1", path = "../mp4parse"}
42+
+mp4parse = {version = "0.9.1", path = "../mp4parse", features = ["mp4parse_fallible"]}
4843
num-traits = "0.1.37"
49-
44+
5045
-[build-dependencies]
51-
-cbindgen = "0.1.30"
46+
-cbindgen = "0.3.1"
5247
-
5348
-[features]
5449
-fuzz = ["mp4parse/fuzz"]

media/mp4parse-rust/mp4parse.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ typedef enum {
4444
MP4PARSE_TRACK_TYPE_AUDIO = 1,
4545
} Mp4parseTrackType;
4646

47-
struct Mp4parseParser;
4847
typedef struct Mp4parseParser Mp4parseParser;
4948

5049
typedef struct {

media/mp4parse-rust/mp4parse/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mp4parse"
3-
version = "0.9.0"
3+
version = "0.9.1"
44
authors = [
55
"Ralph Giles <giles@mozilla.com>",
66
"Matthew Gregan <kinetik@flim.org>",
@@ -24,7 +24,7 @@ exclude = [
2424
byteorder = "1.0.0"
2525
bitreader = { version = "0.3.0" }
2626
num-traits = "0.1.37"
27-
mp4parse_fallible = { path = "../mp4parse_fallible", optional = true }
27+
mp4parse_fallible = { version = "0.0.1", optional = true }
2828

2929
[dev-dependencies]
3030
test-assembler = "0.1.2"

media/mp4parse-rust/mp4parse/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
55
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
6-
#![cfg_attr(feature = "fuzz", feature(plugin))]
7-
#![cfg_attr(feature = "fuzz", plugin(afl_plugin))]
86
#[cfg(feature = "fuzz")]
97
extern crate afl;
108

@@ -1422,7 +1420,7 @@ fn find_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> {
14221420

14231421
fn read_ds_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> {
14241422
let frequency_table =
1425-
vec![(0x1, 96000), (0x1, 88200), (0x2, 64000), (0x3, 48000),
1423+
vec![(0x0, 96000), (0x1, 88200), (0x2, 64000), (0x3, 48000),
14261424
(0x4, 44100), (0x5, 32000), (0x6, 24000), (0x7, 22050),
14271425
(0x8, 16000), (0x9, 12000), (0xa, 11025), (0xb, 8000),
14281426
(0xc, 7350)];

media/mp4parse-rust/mp4parse_capi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mp4parse_capi"
3-
version = "0.9.0"
3+
version = "0.9.1"
44
authors = [
55
"Ralph Giles <giles@mozilla.com>",
66
"Matthew Gregan <kinetik@flim.org>",
@@ -25,6 +25,6 @@ byteorder = "1.0.0"
2525

2626
# To enable fallible memory allocation, add 'features = ["mp4parse_fallible"]'
2727
# in mp4parse brace.
28-
mp4parse = {version = "0.9.0", path = "../mp4parse", features = ["mp4parse_fallible"]}
28+
mp4parse = {version = "0.9.1", path = "../mp4parse", features = ["mp4parse_fallible"]}
2929
num-traits = "0.1.37"
3030

media/mp4parse-rust/update-rust.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Script to update mp4parse-rust sources to latest upstream
33

44
# Default version.
5-
VER=d129e35848895220bae98084c17a7425a3369e0e
5+
VER=c714e7ee1218fb0f51d3c67166fd5fff303a0312
66

77
# Accept version or commit from the command line.
88
if test -n "$1"; then
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"files":{".travis.yml":"9f13da6fb5b7189d5b0e8c0435d28a7d35899e708fd579a7e6b73fc74c3d6acf","Cargo.toml":"7e0306d977c63a491bea39dde354455f23c7eb283abf874d0122a664bbc082d3","README":"1ff38c3749ba83c9b364c6bb35b95525dd956449ec7386a50faf8fcfdd5a7de4","lib.rs":"3c54447b497f808ab7fa7659f1379acf4c5c3def37fc4cc7778281273b84eabb"},"package":"6626c2aef76eb8f984eef02e475883d3fe9112e114720446c5810fc5f045cd30"}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: rust
2+
rust:
3+
- stable
4+
- nightly
5+
6+
addons:
7+
apt:
8+
sources:
9+
- ubuntu-toolchain-r-test
10+
packages:
11+
- g++-5
12+
13+
env:
14+
global:
15+
- CXX=g++-5
16+
17+
script:
18+
- cargo test --all --verbose
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2+
#
3+
# When uploading crates to the registry Cargo will automatically
4+
# "normalize" Cargo.toml files for maximal compatibility
5+
# with all versions of Cargo and also rewrite `path` dependencies
6+
# to registry (e.g. crates.io) dependencies
7+
#
8+
# If you believe there's an error in this file please file an
9+
# issue against the rust-lang/cargo repository. If you're
10+
# editing this file be aware that the upstream Cargo.toml
11+
# will likely look very different (and much more reasonable)
12+
13+
[package]
14+
name = "mp4parse_fallible"
15+
version = "0.0.1"
16+
authors = ["The Servo Project Developers"]
17+
description = "Fallible replacement for Vec"
18+
documentation = "https://docs.rs/mp4parse_fallible/"
19+
license = "MPL-2.0"
20+
repository = "https://github.com/mozilla/mp4parse_fallible"
21+
22+
[lib]
23+
name = "mp4parse_fallible"
24+
path = "lib.rs"
25+
[badges.travis-ci]
26+
repository = "https://github.com/mozilla/mp4parse_fallible"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This is from https://github.com/servo/servo/tree/master/components/fallible
2+
with modificaion for mp4 demuxer.
3+
4+
The purpose of this crate is to solve infallible memory allocation problem
5+
which causes OOM easily on win32. This is more like a temporary solution.
6+
Once rust supports fallible memory allocation in its stdlib, this can be
7+
retired.

0 commit comments

Comments
 (0)