Commit Graph
156 Commits
Author SHA1 Message Date
Andrea Marchesini 74bc0e9cfd Bug 1404845 - Renaming BlobImpl::GetInternalStream to BlobImpl::CreateInputStream, r=smaug 2017-10-02 13:53:12 +02:00
Andrea Marchesini 21b3e6b2ff Bug 1388125 - CloneableWithRangeMediaResource for streams implementing nsICloneableInputStreamWithRange, r=jya 2017-09-18 13:34:43 +02:00
Andrea Marchesini d17869c26b Bug 1388125 - Move ChannelMediaResource to separate files, r=jya 2017-09-18 13:33:49 +02:00
Andrea Marchesini c3af63011a Bug 1388125 - Move FileMediaResource to separate files, r=jya 2017-09-18 13:31:08 +02:00
Andrea Marchesini adb5b9159c Bug 1388125 - FileMediaResource should use BlobImpl->Size() instead of stream::Available() to know the size, r=jya 2017-09-18 13:31:00 +02:00
JW Wang e4ab2efcc7 Bug 1399751. P3 - pass the offset of range request to ChannelMediaResource::OnStartRequest(). r=gerald
So we don't have to look at GetOffset(). We want to reduce the use of
MediaCacheStream::mChannelOffset so it is easier to fix data races about it.

MozReview-Commit-ID: 3GAbKYA9xi4
2017-09-14 14:33:15 +08:00
JW Wang e705d27dd9 Bug 1399372 - update the principal only once per OnDataAvailable() call. r=cpearce
MozReview-Commit-ID: BWyDmKglWsl
2017-08-29 17:57:00 +08:00
JW Wang d27e8c2e59 Bug 1395855. P2 - store the offset of range request. r=cpearce
So we know what to pass to SetupChannelHeaders()
when the channel is redirected.

MozReview-Commit-ID: DbCPGA3qIyn
2017-09-09 00:37:40 +08:00
JW Wang d8537b0d75 Bug 1395855. P1 - remove ChannelMediaResource::mOffset so we have less data race to worry about. r=cpearce
We have MediaCacheStream::mChannelOffset to keep the download positon.
We don't need 2 variables for the same purpose.

MozReview-Commit-ID: IpnEJWuA9A9
2017-09-08 15:09:37 +08:00
JW Wang 9ee3a4a3e7 Bug 1398659. P11 - replace mCacheStream.GetLength() with GetLength(). r=gerald
MozReview-Commit-ID: BGgObe2XG5C
2017-09-08 14:38:22 +08:00
JW Wang 2fa1150d8b Bug 1398659. P10 - remove ChannelMediaResource::mIgnoreClose. r=gerald
mIgnoreClose is always set in conjunction with a call to CloseChannel().
Since mListener->Revoke() will prevent future OnStopRequest() calls from coming,
it is unnecessary to set mIgnoreClose and therefore we can remove this member.

MozReview-Commit-ID: HEXIhIUG8WN
2017-09-08 11:20:39 +08:00
JW Wang 08b3c8e200 Bug 1398659. P9 - remove unused member. r=gerald
MozReview-Commit-ID: 5SSnbYQXxKD
2017-09-07 16:08:10 +08:00
JW Wang 2dbf8cd745 Bug 1398659. P8 - remove the call to mCacheStream.NotifyDataLength() from OpenChannel(). r=gerald
MediaCacheStream::mStreamLength has been set either in Init() or InitAsClone().

MozReview-Commit-ID: L259ecDgjN7
2017-09-07 15:23:57 +08:00
JW Wang 0fae0cb86c Bug 1398659. P7 - tighten up the assertions in OpenChannel(). r=gerald
MozReview-Commit-ID: IPCLOJKx3f3
2017-09-07 15:15:18 +08:00
JW Wang 2c29680140 Bug 1398659. P6 - remove the nsIStreamListener** parameter from OpenChannel(). r=gerald
The only caller is CacheClientSeek() which always passes nullptr to it.

MozReview-Commit-ID: 3CTkbF6ktp2
2017-09-07 15:12:15 +08:00
JW Wang f00e1f1b02 Bug 1398659. P5 - let ChannelMediaResource::Open() set mListener without calling OpenChannel(). r=gerald
This is more efficient because aStreamListener won't be null.

MozReview-Commit-ID: 4b22l7cTK6y
2017-09-05 17:51:22 +08:00
JW Wang 1b28e6a469 Bug 1398659. P4 - remove unused code and add some assertions. r=gerald
MozReview-Commit-ID: LRgF9qjdMXz
2017-09-05 17:39:57 +08:00
JW Wang 2bbf831457 Bug 1398659. P2 - remove the if statement since new() is infallible. r=gerald
MozReview-Commit-ID: 9GobL4M2mjc
2017-09-05 17:31:09 +08:00
JW Wang d03f961e15 Bug 1395802. P4 - we don't need lock since mChannelStatistics is always accessed on the main thread. r=cpearce
MozReview-Commit-ID: KHnhPaSTSFr
2017-09-01 14:32:00 +08:00
JW Wang 86b6448016 Bug 1395802. P3 - ensure mChannelStatistics.AddBytes() to happen on the main thread. r=cpearce
MozReview-Commit-ID: CbDl9mWZDFs
2017-09-01 14:28:06 +08:00
JW Wang aadd4069fa Bug 1395802. P2 - assert ChannelMediaResource::GetDownloadRate() runs on the main thread. r=cpearce
The only caller is ChannelMediaDecoder::GetStatistics() which runs on the main thread.

MozReview-Commit-ID: CYg3Z3rmlHd
2017-09-01 14:19:51 +08:00
JW Wang 0adbe221bd Bug 1395842 - tighten up assertions in ChannelSuspendAgent which runs on the main thread only. r=alwu
MozReview-Commit-ID: AK3YHAz750D
2017-09-01 15:44:38 +08:00
Phil Ringnalda 24e7cdc7a4 Backed out 3 changesets (bug 1395017) for frequent failures in test_video_crossorigin.html
Backed out changeset 438657f4637d (bug 1395017)
Backed out changeset 243ef641e6c3 (bug 1395017)
Backed out changeset 78625f947f69 (bug 1395017)

MozReview-Commit-ID: DeBaUOPQrAD
2017-09-05 22:39:50 -07:00
JW Wang 7dcdf92a5a Bug 1395017. P3 - always dispatch a task to run UpdatePrincipal() even when CacheClientUpdatePrincipal() already runs in the main thread. r=cpearce
When MediaCacheStream::NotifyDataReceived() runs off the main thread,
there is no guarantee that the principal will be updated before the new
data is observable to the consumer because the principal can only be
updated on the main thread while the consumer can access the data off
the main thread.

To make the code simpler, we always dispatch a task to run UpdatePrincipal()
even when CacheClientUpdatePrincipal() already runs in the main thread.

This also avoid the deadlock because ChannelMediaResource::UpdatePrincipal()
will never run with the cache monitor held.

MozReview-Commit-ID: 9CdrJnaV0hl
2017-08-30 11:42:25 +08:00
JW Wang 35b532a6f8 Bug 1395017. P1 - dispatch a task to the main thread to update the principal when necessary. r=cpearce
MozReview-Commit-ID: BWyDmKglWsl
2017-08-29 17:57:00 +08:00
JW Wang 6cfb7dae94 Bug 1395431 - dispatch a task to call MediaResourceCallback::NotifyDataArrived() in CacheClientNotifyDataReceived(). r=cpearce
Since MediaResourceCallback is ref-counted, we don't need nsRevocableEventPtr
to handle the case ChannelMediaResource might go away before mCallback->NotifyDataArrived()
is run. This also avoid the data race in accessing mDataReceivedEvent on different threads
when OMT data delivery is enabled.

MozReview-Commit-ID: 1Tbjxrm1ar5
2017-08-30 11:58:43 +08:00
JW Wang 3e640e4753 Bug 1394724. P3 - fix data race in reading mClosed in MediaCacheStream::NotifyDataReceived(). r=cpearce
1. mCacheStream.Close() should happen after CloseChannel() to avoid data race
   in reading mClosed in MediaCacheStream::NotifyDataReceived().
2. MediaCache::Update() and CloseStreamsForPrivateBrowsing() should call
   ChannelMediaResource::Close() to ensure mCacheStream.Close() happens
   after CloseChannel().

MozReview-Commit-ID: 1o3yPbm3Gy6
2017-08-29 16:41:17 +08:00
JW Wang 7c5b2a74ac Bug 1394724. P2 - mListener->Revoke() should happen after mChannel->Cancel() to avoid data race. r=cpearce
http://searchfox.org/mozilla-central/rev/cd82cacec2cf734768827ff85ba2dba90a534c5e/netwerk/base/nsIRequest.idl#56
All OnDataAvailable() calls should happen before Cancel().
It is safe to modify mResource after a call to Cancel().

MozReview-Commit-ID: KoeLth1zlZM
2017-08-29 15:55:20 +08:00
JW Wang d8a6ee662b Bug 1394724. P1 - assert the channel is already closed in ~ChannelMediaResource(). r=cpearce
MozReview-Commit-ID: 4lJNEEBsv4r
2017-08-29 15:41:40 +08:00
JW Wang a2e1bd0943 Bug 1394705 - let HTMLMediaElement::MediaLoadListener implement nsIThreadRetargetableStreamListener. r=cpearce
This is required to use nsIThreadRetargetableRequest::RetargetDeliveryTo().

MozReview-Commit-ID: GFuAjovabpY
2017-08-29 14:28:13 +08:00
JW Wang a3b9555ecf Bug 1393365 - MediaResource doesn't need to inherit nsISupports. r=cpearce
MozReview-Commit-ID: LoSctajrULP
2017-08-24 16:44:23 +08:00
JW Wang dbc9cf7d4e Bug 1393345 - remove MediaResource::IsSuspended() which has no callers. r=gerald
MozReview-Commit-ID: Jn6TIXpFflR
2017-08-23 15:52:33 +08:00
JW Wang 79fe96e01f Bug 1392919. P2 - remove MediaResource::IsSuspendedByCache(). r=gerald
MozReview-Commit-ID: E1lkfLARMhS
2017-08-23 14:38:00 +08:00
JW Wang 23c03df99e Bug 1392919. P1 - include the suspend status when notifying NotifySuspendedStatusChanged. r=gerald
MozReview-Commit-ID: GwzIBNLjcZr
2017-08-23 14:32:51 +08:00
Chris Pearce b09f61f76c Bug 1390748 - Pre-declare MediaDecoder in HTMLMediaElement. r=jwwang
I noticed that touching MediaDecoder rebuilds a lot of seemingly unrelated
code. This is because HTMLMediaElement includes MediaDecoder.h, and
HTMLMediaElement is included in a number of places. Having HTMLMediaElement.h
predeclare rather than include fixes it.

MozReview-Commit-ID: I0vrPgqvvge
2017-08-15 17:09:06 +12:00
Carsten "Tomcat" Book 900a6c3b92 Backed out changeset 4a31e4302e03 (bug 1390748) 2017-08-17 08:35:30 +02:00
Chris Pearce a90b42435d Bug 1390748 - Pre-declare MediaDecoder in HTMLMediaElement. r=jwwang
I noticed that touching MediaDecoder rebuilds a lot of seemingly unrelated
code. This is because HTMLMediaElement includes MediaDecoder.h, and
HTMLMediaElement is included in a number of places. Having HTMLMediaElement.h
predeclare rather than include fixes it.

MozReview-Commit-ID: I0vrPgqvvge
2017-08-15 17:09:06 +12:00
Phil Ringnalda 34d25d405e Backed out 10 changesets (bug 1390748) for build bustage
Backed out changeset 02b36ee5fb17 (bug 1390748)
Backed out changeset 84e8bf01c856 (bug 1390748)
Backed out changeset fc8989be30f3 (bug 1390748)
Backed out changeset 14d421ace6cc (bug 1390748)
Backed out changeset 7dadac869038 (bug 1390748)
Backed out changeset 0e77809e7bc2 (bug 1390748)
Backed out changeset bf78a8dce9c5 (bug 1390748)
Backed out changeset 5fa77990472e (bug 1390748)
Backed out changeset 5d3b637d2485 (bug 1390748)
Backed out changeset 634fe076d134 (bug 1390748)

MozReview-Commit-ID: Dxio8vXDCHg
2017-08-16 21:33:10 -07:00
Chris Pearce c4c0db8c23 Bug 1390748 - Pre-declare MediaDecoder in HTMLMediaElement. r=jwwang
I noticed that touching MediaDecoder rebuilds a lot of seemingly unrelated
code. This is because HTMLMediaElement includes MediaDecoder.h, and
HTMLMediaElement is included in a number of places. Having HTMLMediaElement.h
predeclare rather than include fixes it.

MozReview-Commit-ID: I0vrPgqvvge
2017-08-15 17:09:06 +12:00
JW Wang 133ce481a6 Bug 1388612. P1 - remove MediaResource::EnsureCacheUpToDate(). r=gerald
This is a workaround to fix bug 687972. It should be OK now to remove
it since we have fix bug 1108960  where MediaCache failed to run the
update loop to update the suspend status of the stream.

MozReview-Commit-ID: MbInehhScs
2017-08-09 16:07:53 +08:00
Honza Bambas 2fb8e43c7d Bug 1377206 - Explicitly disable throttling of media HTTP responses, r=cpearce 2017-08-04 04:38:00 +02:00
JW Wang ba4e1416b8 Bug 1383628. P4 - move CloneData() and Create() from MediaResource to BaseMediaResource. r=gerald
Now we can store a more specific resource type in ChannelMediaDecoder.

MozReview-Commit-ID: EzXC547O7aR
2017-08-04 14:52:22 +08:00
JW Wang 07f6b2ed41 Bug 1385699. P3 - remove MediaDecoder::SetInfinite() and related code. r=cpearce
Since inf can be encoded in MDSM::mDuration, we don't need an additional flag
in MediaDecoder to indicate 'infinite' anymore. Note duration change from infinite
to finite is handled by MDSM, so we can remove the explicit calls to SetInfinite(false).

MozReview-Commit-ID: EoxwZJzPAJl
2017-08-01 14:15:29 +08:00
Gerald Squelart 73c7b24489 Bug 1384243 - Sanitize offset inputs in MediaResourceIndex - r=cpearce
Also check that the offset doesn't overflow during reads.

MozReview-Commit-ID: DT5neeZuMZu
2017-08-01 14:07:55 +12:00
Bevis Tseng 2ecbda13e2 Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm 2017-07-26 16:13:35 +08:00
Chris Pearce 4d91aad35b Bug 1370177 - Treat compressed HTTP channels as having infinite length and as unseekable in media code. r=jwwang.
The problem here is that the server is setting the Content-Length to the size
of the gzipped file, which is confusing our media code as that's not the length
of the decompressed stream. Necko's decompressor is streaming, so we can't know
the length of the stream in advance unless we wait for the entire file to
download first. We also can't seek in compressed HTTP resources anyway.

So just have our code assume that compressed HTTP channels are of infinite
length and have un unseekable transport. Then we can seek in the buffered
regions at least.

MozReview-Commit-ID: 9SiLuMZGSeJ
2017-07-04 15:31:48 +12:00
Chris Pearce 585f239fc8 Bug 1373618 - Prevent ChannelMediaResource from making a "Range: bytes=$length-" request at end of stream. r=jwwang
Not all web servers consistently handle an HTTP 1.1 Byte Range Request for
"Range: bytes=$length-". Apache responds with 416, but others do not. So to
make us impervious to servers that respond with something other than 416, just
have us not make such a request when we know that the server thinks our
requested range is unsatisfiable.

We make such a request when we reach end of stream for a stream that has been
suspended/resumed. We are now more likely to suspend and resume streams with the
recent changes to our throttling logic.



MozReview-Commit-ID: 6URqzjLglOM
2017-07-04 12:05:23 +12:00
JW Wang 79d43992a0 Bug 1377370. P3 - remove HLS related code from MediaResource.cpp. r=kikuo
MozReview-Commit-ID: FnZEMNDjjmE
2017-06-30 10:22:36 +08:00
JW Wang c91ec35f16 Bug 1376363. P3 - remove MediaResource::GetContentType() and its friends. r=gerald
Note we remove the call to mChannel->SetContentType() from RecreateChannel().

The hint never works as expected for [1] is the only caller to
nsIChannel::GetContentType() and MediaResource::Create() always happens
before any reads from the resource.

[1] http://searchfox.org/mozilla-central/rev/b425854d9bbd49d5caf9baef3686e49ec91c17ec/dom/media/MediaResource.cpp#1500

MozReview-Commit-ID: 1n4yHEouCjC
2017-06-26 21:39:16 +08:00
JW Wang 6c70919551 Bug 1376360. P3 - remove the call path for null aStreamListener in FileMediaResource::Open(). r=gerald
Null aStreamListener is passed only when cloning.
Since we remove cloning in P2, we can now remove the call path.

MozReview-Commit-ID: B0vKVy5jsqo
2017-06-23 16:35:09 +08:00