Bug 1275189 - Remove thread::JoinHandle panic guard. r=kinetik

We've audited this code, so the calls inside the closure should
be panic-free. Meanwhile the thread join() itself seems to be
panicing on windows. This will at least get us a more obvious
crash.

MozReview-Commit-ID: JXoDOOu2x0K

--HG--
extra : rebase_source : 661da4e8e8dc98e25b318a51c49a406ee86beb46
This commit is contained in:
Ralph Giles 2016-05-24 14:42:42 -07:00
Родитель d800a1712f
Коммит dad637eb4a
3 изменённых файлов: 58 добавлений и 16 удалений

Просмотреть файл

@ -0,0 +1,42 @@
diff --git a/media/libstagefright/binding/mp4parse/capi.rs b/media/libstagefright/binding/mp4parse/capi.rs
index 6e8c6f9..ed7e566 100644
--- a/media/libstagefright/binding/mp4parse/capi.rs
+++ b/media/libstagefright/binding/mp4parse/capi.rs
@@ -174,22 +174,21 @@ pub unsafe extern "C" fn mp4parse_get_track_info(context: *mut MediaContext, tra
return MP4PARSE_ERROR_INVALID;
}
- std::thread::spawn(move || {
- let track = &context.tracks[track_index];
- let empty_duration = if track.empty_duration.is_some() {
- media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
- } else {
- 0
- };
- info.media_time = if track.media_time.is_some() {
- track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
- } else {
- 0
- };
- info.duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
- info.track_id = track.track_id.unwrap();
- MP4PARSE_OK
- }).join().unwrap_or(MP4PARSE_ERROR_INVALID)
+ let track = &context.tracks[track_index];
+ let empty_duration = if track.empty_duration.is_some() {
+ media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
+ } else {
+ 0
+ };
+ info.media_time = if track.media_time.is_some() {
+ track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
+ } else {
+ 0
+ };
+ info.duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
+ info.track_id = track.track_id.unwrap();
+
+ MP4PARSE_OK
}
#[no_mangle]

Просмотреть файл

@ -174,22 +174,21 @@ pub unsafe extern "C" fn mp4parse_get_track_info(context: *mut MediaContext, tra
return MP4PARSE_ERROR_INVALID;
}
std::thread::spawn(move || {
let track = &context.tracks[track_index];
let empty_duration = if track.empty_duration.is_some() {
media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
} else {
0
};
info.media_time = if track.media_time.is_some() {
track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
} else {
0
};
info.duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
info.track_id = track.track_id.unwrap();
MP4PARSE_OK
}).join().unwrap_or(MP4PARSE_ERROR_INVALID)
let track = &context.tracks[track_index];
let empty_duration = if track.empty_duration.is_some() {
media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
} else {
0
};
info.media_time = if track.media_time.is_some() {
track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
} else {
0
};
info.duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
info.track_id = track.track_id.unwrap();
MP4PARSE_OK
}
#[no_mangle]

Просмотреть файл

@ -34,6 +34,7 @@ cp _upstream/byteorder/src/new.rs mp4parse/byteorder/new.rs
echo "Applying patches..."
patch -p4 < byteorder-mod.patch
patch -p4 < mp4parse-mod.patch
patch -p4 < mp4parse-thread.patch
echo "Cleaning up..."
rm -rf _upstream