зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1448762 - Update mp4parse-rust to 9e70cb4. r=padenot
MozReview-Commit-ID: 2RuByCeEEe5 --HG-- extra : rebase_source : 7233a91cffe16c2d89bbc1396dbfe1c834e2109b
This commit is contained in:
Родитель
2d686a4869
Коммит
ccb5482936
|
@ -830,7 +830,7 @@ dependencies = [
|
|||
"encoding_glue 0.1.0",
|
||||
"geckoservo 0.0.1",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mp4parse_capi 0.10.0",
|
||||
"mp4parse_capi 0.10.1",
|
||||
"netwerk_helper 0.0.1",
|
||||
"nserror 0.1.0",
|
||||
"nsstring 0.1.0",
|
||||
|
@ -1274,7 +1274,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mp4parse"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
dependencies = [
|
||||
"bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1289,11 +1289,11 @@ version = "0.1.0"
|
|||
|
||||
[[package]]
|
||||
name = "mp4parse_capi"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
dependencies = [
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mp4parse 0.10.0",
|
||||
"mp4parse 0.10.1",
|
||||
"num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ index a30e045..a965f06 100644
|
|||
|
||||
# To enable fallible memory allocation, add 'features = ["mp4parse_fallible"]'
|
||||
# in mp4parse brace.
|
||||
-mp4parse = {version = "0.10.0", path = "../mp4parse"}
|
||||
+mp4parse = {version = "0.10.0", path = "../mp4parse", features = ["mp4parse_fallible"]}
|
||||
-mp4parse = {version = "0.10.1", path = "../mp4parse"}
|
||||
+mp4parse = {version = "0.10.1", path = "../mp4parse", features = ["mp4parse_fallible"]}
|
||||
num-traits = "0.2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mp4parse"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = [
|
||||
"Ralph Giles <giles@mozilla.com>",
|
||||
"Matthew Gregan <kinetik@flim.org>",
|
||||
|
|
|
@ -1377,6 +1377,12 @@ fn find_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> {
|
|||
let mut end: u32 = 0; // It's u8 without declaration type that is incorrect.
|
||||
// MSB of extend_or_len indicates more bytes, up to 4 bytes.
|
||||
for _ in 0..4 {
|
||||
if (des.position() as usize) == remains.len() {
|
||||
// There's nothing more to read, the 0x80 was actually part of
|
||||
// the content, and not an extension size.
|
||||
end = des.position() as u32;
|
||||
break;
|
||||
}
|
||||
let extend_or_len = des.read_u8()?;
|
||||
end = (end << 7) + (extend_or_len & 0x7F) as u32;
|
||||
if (extend_or_len & 0x80) == 0 {
|
||||
|
|
|
@ -897,6 +897,34 @@ fn read_qt_wave_atom() {
|
|||
assert_eq!(codec_type, super::CodecType::MP3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_descriptor_80() {
|
||||
let aac_esds =
|
||||
vec![
|
||||
0x03, 0x80, 0x80, 0x80, 0x22, 0x00, 0x02, 0x00,
|
||||
0x04, 0x80, 0x80, 0x80, 0x17, 0x40, 0x15, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x22, 0xBC, 0x00, 0x01,
|
||||
0xF5, 0x83, 0x05, 0x80, 0x80, 0x80, 0x02, 0x11,
|
||||
0x90, 0x06, 0x80, 0x80, 0x80, 0x01, 0x02
|
||||
];
|
||||
let aac_dc_descriptor = &aac_esds[31 .. 33];
|
||||
let mut stream = make_box(BoxSize::Auto, b"esds", |s| {
|
||||
s.B32(0) // reserved
|
||||
.append_bytes(aac_esds.as_slice())
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
|
||||
let es = super::read_esds(&mut stream).unwrap();
|
||||
|
||||
assert_eq!(es.audio_codec, super::CodecType::AAC);
|
||||
assert_eq!(es.audio_object_type, Some(2));
|
||||
assert_eq!(es.audio_sample_rate, Some(48000));
|
||||
assert_eq!(es.audio_channel_count, Some(2));
|
||||
assert_eq!(es.codec_esds, aac_esds);
|
||||
assert_eq!(es.decoder_specific_data, aac_dc_descriptor);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_esds() {
|
||||
let aac_esds =
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/// Verify we're built with run-time integer overflow detection.
|
||||
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "attempt to add with overflow")]
|
||||
fn overflow_protection() {
|
||||
let edge = u32::max_value();
|
||||
assert_eq!(0u32, edge + 1);
|
||||
|
||||
let edge = u64::max_value();
|
||||
assert_eq!(0u64, edge + 1);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mp4parse_capi"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = [
|
||||
"Ralph Giles <giles@mozilla.com>",
|
||||
"Matthew Gregan <kinetik@flim.org>",
|
||||
|
@ -26,7 +26,7 @@ log = "0.4"
|
|||
|
||||
# To enable fallible memory allocation, add 'features = ["mp4parse_fallible"]'
|
||||
# in mp4parse brace.
|
||||
mp4parse = {version = "0.10.0", path = "../mp4parse", features = ["mp4parse_fallible"]}
|
||||
mp4parse = {version = "0.10.1", path = "../mp4parse", features = ["mp4parse_fallible"]}
|
||||
num-traits = "0.2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -826,23 +826,7 @@ impl<'a> Iterator for SampleToChunkIterator<'a> {
|
|||
fn next(&mut self) -> Option<(u32, u32)> {
|
||||
let has_chunk = self.chunks.next()
|
||||
.or_else(|| {
|
||||
self.chunks = match (self.stsc_peek_iter.next(), self.stsc_peek_iter.peek()) {
|
||||
(Some(next), Some(peek)) if next.first_chunk > 0 && peek.first_chunk > 0 => {
|
||||
self.sample_count = next.samples_per_chunk;
|
||||
((next.first_chunk - 1) .. (peek.first_chunk - 1))
|
||||
},
|
||||
(Some(next), None) if next.first_chunk > 0 => {
|
||||
self.sample_count = next.samples_per_chunk;
|
||||
// Total chunk number in 'stsc' could be different to 'stco',
|
||||
// there could be more chunks at the last 'stsc' record.
|
||||
match next.first_chunk.checked_add(self.remain_chunk_count) {
|
||||
Some(r) => ((next.first_chunk - 1) .. r - 1),
|
||||
_ => (0 .. 0),
|
||||
}
|
||||
},
|
||||
_ => (0 .. 0),
|
||||
};
|
||||
|
||||
self.chunks = self.locate();
|
||||
self.remain_chunk_count.checked_sub(self.chunks.len() as u32).and_then(|res| {
|
||||
self.remain_chunk_count = res;
|
||||
self.chunks.next()
|
||||
|
@ -853,6 +837,34 @@ impl<'a> Iterator for SampleToChunkIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> SampleToChunkIterator<'a> {
|
||||
fn locate(&mut self) -> std::ops::Range<u32> {
|
||||
loop {
|
||||
return match (self.stsc_peek_iter.next(), self.stsc_peek_iter.peek()) {
|
||||
(Some(next), Some(peek)) if next.first_chunk == peek.first_chunk => {
|
||||
// Invalid entry, skip it and will continue searching at
|
||||
// next loop iteration.
|
||||
continue
|
||||
},
|
||||
(Some(next), Some(peek)) if next.first_chunk > 0 && peek.first_chunk > 0 => {
|
||||
self.sample_count = next.samples_per_chunk;
|
||||
(next.first_chunk - 1) .. (peek.first_chunk - 1)
|
||||
},
|
||||
(Some(next), None) if next.first_chunk > 0 => {
|
||||
self.sample_count = next.samples_per_chunk;
|
||||
// Total chunk number in 'stsc' could be different to 'stco',
|
||||
// there could be more chunks at the last 'stsc' record.
|
||||
match next.first_chunk.checked_add(self.remain_chunk_count) {
|
||||
Some(r) => (next.first_chunk - 1) .. r - 1,
|
||||
_ => 0 .. 0,
|
||||
}
|
||||
},
|
||||
_ => 0 .. 0
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn create_sample_table(track: &Track, track_offset_time: i64) -> Option<Vec<Mp4parseIndice>> {
|
||||
let timescale = match track.timescale {
|
||||
Some(ref t) => TrackTimeScale::<i64>(t.0 as i64, t.1),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Script to update mp4parse-rust sources to latest upstream
|
||||
|
||||
# Default version.
|
||||
VER="ded91a1661daaf55515e572aadd8e92e6d71cbaf"
|
||||
VER="9e70cb418401c152cd3183aab06b084c0ce3f3e6"
|
||||
|
||||
# Accept version or commit from the command line.
|
||||
if test -n "$1"; then
|
||||
|
|
Загрузка…
Ссылка в новой задаче