mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1418430. P2 - simplify the if statement of "reopen on error". r=bechen,gerald
A truth table is listed to illustrate all conditions of length/offset/reopen. The original code doesn't handle the following cases correctly: 1. length == offset == 0, shouldn't reopen the channel for there is no data to download. 2. length == -1 && offset > 0, should reopen the channel if seekable. MozReview-Commit-ID: IisnrA8hK4M --HG-- extra : rebase_source : c5826f314b09b2ae9c3e7f2cc1f6ce285fc612df
This commit is contained in:
parent
df2b00d7a6
commit
f874190157
@ -2145,11 +2145,25 @@ MediaCacheStream::NotifyDataEndedInternal(uint32_t aLoadID,
|
||||
// cases where we don't need to reopen are when *we* closed the stream.
|
||||
// But don't reopen if we need to seek and we don't think we can... that would
|
||||
// cause us to just re-read the stream, which would be really bad.
|
||||
/*
|
||||
* | length | offset | reopen |
|
||||
* +--------+-----------+----------+
|
||||
* | -1 | 0 | yes |
|
||||
* +--------+-----------+----------+
|
||||
* | -1 | > 0 | seekable |
|
||||
* +--------+-----------+----------+
|
||||
* | 0 | X | no |
|
||||
* +--------+-----------+----------+
|
||||
* | > 0 | 0 | yes |
|
||||
* +--------+-----------+----------+
|
||||
* | > 0 | != length | seekable |
|
||||
* +--------+-----------+----------+
|
||||
* | > 0 | == length | no |
|
||||
*/
|
||||
if (aReopenOnError && aStatus != NS_ERROR_PARSED_DATA_CACHED &&
|
||||
aStatus != NS_BINDING_ABORTED &&
|
||||
(mChannelOffset == 0 ||
|
||||
(mStreamLength > 0 && mChannelOffset != mStreamLength &&
|
||||
mIsTransportSeekable))) {
|
||||
(mChannelOffset == 0 || mIsTransportSeekable) &&
|
||||
mChannelOffset != mStreamLength) {
|
||||
// If the stream did close normally, restart the channel if we're either
|
||||
// at the start of the resource, or if the server is seekable and we're
|
||||
// not at the end of stream. We don't restart the stream if we're at the
|
||||
|
Loading…
Reference in New Issue
Block a user