Граф коммитов

36 Коммитов

Автор SHA1 Сообщение Дата
Andrea Marchesini a7033b2822 Bug 1515658 - ChannelMediaResource should use the BlobURLs' length when known, r=jya 2019-01-03 19:22:49 +01:00
Sylvestre Ledru 804b8b8883 Bug 1204606 - Reformat of dom/media r=jya
# skip-blame

Differential Revision: https://phabricator.services.mozilla.com/D12251

--HG--
extra : moz-landing-system : lando
2018-11-19 13:25:37 +00:00
Jean-Yves Avenard 756a7bdfd8 Bug 1473173 - Report MediaResource as seekable if we know we will never seek into underlying transport. r=bryce
The MediaCache reads content by block of BLOCK_SIZE bytes (currently 32kB). As such, if a content being fetched is less than BLOCK_SIZE, it will always be fully read from offset = 0. We can then seek within this buffered content regardless of the underlying HTTP connection supporting request-range or not.

test_bug686942.html is ultimately testing a racy behaviour: it attempts to seek into a resource that isn't always seekable (http.js doesn't report Range -Request support for small files). The seekable range becomes then the buffered range which at the time of loadedmetadata may not be set yet.

Differential Revision: https://phabricator.services.mozilla.com/D3028

--HG--
extra : moz-landing-system : lando
2018-08-09 19:53:07 +00:00
Chris Pearce a19e516c04 Bug 1443942 - Ensure MediaCacheStreams are initialized with the length of the resource, not the length of the byte range response. r=jya
I'm seeing intermittent failures of test_midflight_redirect_blocked. In this
test, our custom server responds to Firefox's 0- HTTP Byte Range request with a
[0,200] response. When Firefox requests 200-, the server responds with a cross
origin redirect, and then the remainder of the resource.

However sometimes while running test_midflight_redirect_blocked the MP4 demuxer
reads through all 200 bytes while trying to parse metadata before the redirect
has occurred and fed more data into the cache, and so the demuxer thinks it's
hit end of stream, and reports a failure. The demuxer thinks it's hit end of
stream, because we initialize the MediaCacheStream length in
ChannelMediaResource::Open() with the value of the Content-Length HTTP header.
But in an HTTP byte range response, the Content-Length header tells you the
length of the range returned, not the length of the entire resource. The length
of the resource is in the Content-Range header, we need to use that if
available.

So to fix this intermittent test failure, we need to also parse the
Content-Range header in ChannelMediaResource::Open(), and use the length from
that if available.

MozReview-Commit-ID: 29pPRsUvxag

--HG--
extra : rebase_source : ba1ef03d65ebd22698a29d8385f36b4c747ccf43
2018-04-04 12:36:00 +12:00
JW Wang 51a137168e Bug 1427699. P2 - rewrite InitAsCloneInternal() to mimic the case where data is downloaded from a channel. r=gerald
Note we add mClient->CacheClientSuspend() so the network state of the element
is changed to IDLE because we have no channel to fetch data initially.

MozReview-Commit-ID: DgJbMxvJBzH

--HG--
extra : rebase_source : 69a3ef35d4b5faaaa645fabe02246d49aebce22e
extra : source : 61ec40ce378a444ec0f74d474c28b6a9db3aa830
2018-01-05 16:31:39 +08:00
JW Wang 0c88150fb7 Bug 1426578. P1 - tweak the constructor and init functions of ChannelMediaResource/MediaCacheStream. r=bechen,gerald
We want to init as many members as possible before taking the cache monitor.
This makes it easier to move part of the init functions to another thread.

MozReview-Commit-ID: 6mmO356nCyQ

--HG--
extra : rebase_source : 0e5093e01227e2008200cc1fa02aaac445833614
extra : intermediate-source : 2a6bf63954734d0c6470b425a9a8a77f8a805dc3
extra : source : 782ebf089ec17570650ce1635a591c3a9838d7a3
2017-12-14 16:08:17 +08:00
JW Wang 37e466a4bf Bug 1426056. P2 - remove unused members. r=bechen,gerald
MozReview-Commit-ID: 6CjxrFzutkP

--HG--
extra : rebase_source : b9c9a858e08ea0aa35c074ac7734d62b1d8fe219
extra : intermediate-source : ce131c8c66ef1dc89c69fd0e2332b838419a3cc3
extra : source : e6ece8e702100d23540caf9fbcfea561dcb3e172
2017-12-07 15:45:15 +08:00
JW Wang d764d94fc5 Bug 1425170. P1 - add a member to ChannelMediaResource to store the nsIPrincipal. r=bechen,gerald
Note SharedInfo contains an array to store the original and cloned resources.
This allows us to iterate over resources on the main thread without taking the
cache monitor.

MozReview-Commit-ID: K3gcPYbf72Z

--HG--
extra : rebase_source : eaa070a889797c29d2599b4c3d2507f440d476e7
extra : source : 5dc420815d7a26771c176cdc7b6a87a1c2278da8
2017-12-08 11:08:38 +08:00
JW Wang bb45ff010e Bug 1424973. P1 - propagate 'IsLiveStream' changes to MDSM in MediaDecoder subclasses. r=bechen,gerald
MozReview-Commit-ID: 8wSZf7pRERP

--HG--
extra : rebase_source : c2bea725064f5ad2e1cd1de1b8b9c19994bad89b
extra : intermediate-source : 54da627350d8a6276f9ad5d14a7191cb05957901
extra : source : dc582401401272df3150fb639bdf0ad05d749a06
2017-12-06 16:00:20 +08:00
Gerald Squelart 1b357db99b Bug 1407810 - Use DDLogger in media stack - r=jwwang
Mostly-mechanical additions:
- Log constructions&destructions, usually by just inheriting from
  DecoderDoctorLifeLogger, otherwise with explicit log commands (for internal
  classes for which DecoderDoctorTraits can't be specialized),
- Log links between most objects, e.g.: Media element -> decoder -> state
  machine -> reader -> demuxer -> resource, etc.

And logging some important properties and events (JS events, duration change,
frames being decoded, etc.)

More will be added later on, from just converting MOZ_LOGs, and as needed.

MozReview-Commit-ID: KgNhHSz35t0

--HG--
extra : rebase_source : dd7206e350e32671adc6f3b9e54ebf777251de2c
2017-10-10 17:55:27 +11:00
JW Wang 0d7066652a Bug 1421864 - move mChannelStatistics from ChannelMediaResource to MediaCacheStream. r=bechen,gerald
So it is callable from non-main thread.

MozReview-Commit-ID: atYmz4u2c9

--HG--
extra : rebase_source : 2e10064730b3e7e1ecb1a4fd65cf2e2da0390290
extra : source : 5680a6942f6985f9c6bbf284a9768ab910b37804
2017-11-29 16:49:54 +08:00
JW Wang ce20f92811 Bug 1420016 - remove ChannelMediaResource::IsSuspendedByCache(). r=bechen,gerald
For it is used internally by CacheClientNotifySuspendedStatusChanged() only.

MozReview-Commit-ID: 8XVUHhdERYR

--HG--
extra : rebase_source : 60b97821b3e1c13bf1ba706ad1431b9e323df319
extra : intermediate-source : 6891fae737691efcf0885ff90fc7af777f9493d8
extra : source : 8c49a2fbc12f59c83809d233c9c0e9fa404cdd21
2017-11-23 11:30:07 +08:00
JW Wang df2b00d7a6 Bug 1418430. P1 - always check "reopen on error" when a connection is closed. r=bechen,gerald
The server might send us fewer bytes than requested. So we also need
"reopen on error" in this case as well.

MozReview-Commit-ID: Fi82x4h1TZ0

--HG--
extra : rebase_source : 3a19838de9c11545f00778623735c7e9a5cb1439
2017-11-22 10:35:48 +08:00
JW Wang 5a99c6b197 Bug 1417774 - remove unused MediaResource::Tell(). r=bechen
MozReview-Commit-ID: 3qlP4sSh9kM

--HG--
extra : rebase_source : 4002fec6f8c43abb640f9206cd715f3ecb02b373
2017-11-15 17:18:52 +08:00
JW Wang 69b23fa72c Bug 1415461 - consolidate the life cycle of the channel managed by ChannelSuspendAgent. r=bechen,gerald
We want to suspend/resume a channel only after OnStartRequest()
and before OnStopRequest().

MozReview-Commit-ID: 4QNRdsVvyAK

--HG--
extra : rebase_source : 6514ffe15247892042581df51decbaba4fb756b7
extra : intermediate-source : 930c31e1a06c70b69060f9f0079be186c2f2793b
extra : source : 42fb27a7fb2b3b0bea9d5e4fa0d5ba07f6fa1d3e
2017-11-08 16:16:24 +08:00
JW Wang 2196441028 Bug 1415438 - move mReopenOnError from ChannelMediaResource to ChannelMediaResource::Listener. r=bechen,gerald
http://searchfox.org/mozilla-central/rev/ed212c79cfe86357e9a5740082b9364e7f6e526f/dom/media/ChannelMediaResource.cpp#727-729

mReopenOnError is a flag to reopen the channel when resume fails.
It makes more sense to associate this member with the channel we are resuming.

MozReview-Commit-ID: DwKUyvyzWdi

--HG--
extra : rebase_source : 430b51545106c10a9c53592063aed72433336111
extra : intermediate-source : 9d315280bcc755664001b5dd4d37eb52c5166b82
extra : source : e87e3cc8f9da47f2880d1e817f80638988409498
2017-11-08 14:25:31 +08:00
JW Wang 1e7878c69a Bug 1415069 - Add a member to ChannelMediaResource to remember seekability of the channel. r=bechen,gerald
So it doesn't need to call mCacheStream.IsTransportSeekable() which needs to
take the lock and might block the main thread.

MozReview-Commit-ID: 99QVcSxzjCz

--HG--
extra : rebase_source : be71b065ce0334987efbfb67a5cf010ab0373d80
extra : source : 2de3f0baf1475e8ae3228a33cf4cf139cf923c37
2017-11-07 14:26:10 +08:00
JW Wang 68005e8e16 Bug 1411808. P2 - don't call mClient->IsSuspended() off the main thread in Update(). r=gerald
By mirroring the suspend status of the client, Update() is able to make
decisions on reading streams without calling mClient->IsSuspended().

MozReview-Commit-ID: G4gS2VGiMjj

--HG--
extra : rebase_source : bcdc1010fce47965c999df61666983c87e189670
extra : intermediate-source : 9dd8cfb80e29677e8cae866b2326dfb0aec5b6ae
extra : source : d20f640bf99478c9ba581e4979ec8091ef94e0f3
2017-10-24 11:25:41 +08:00
JW Wang 85ebf6211b Bug 1413483 - add mPendingSeekOffset to store the seek offset initiated by the cache. r=gerald
Seek() can't create a new channel if the resource is still suspended. we need
to store the seek offset specified by the cache so we know where to seek when
the resource is resumed.

Otherwise the new channel will download data at the wrong position and the
cache will need to run Update() and call CacheClientSeek() again which is
a waste.

MozReview-Commit-ID: 9OJ3FRnKitT

--HG--
extra : rebase_source : 562a1503640e1e25672bf3e693698ecc8ff29db6
extra : intermediate-source : e4945cc86c4c2b31fa3f20a32331db4ca1875c38
extra : source : a65982e09035f4aea7b4dcbde25b2a42565d932f
2017-10-27 14:33:16 +08:00
JW Wang 72da413a88 Bug 1412204 - add a member to ChannelMediaResource to indicate Close() has been called. r=gerald
So we can check this member without calling mCacheStream.IsClosed() which need
to acquire the lock and might block the main thread.

MozReview-Commit-ID: 4SPooaprrOw

--HG--
extra : rebase_source : 36cbb2d02c29737a6b2060d588f4919cb9d55c05
extra : intermediate-source : 213f6fef98475069d2719ec6c9d1afaacb8a80ed
extra : source : 63200b22f2be79d6f0ff158e5b0c8f5b49849bf1
2017-10-27 13:46:44 +08:00
JW Wang 1196be8421 Bug 1411504. P4 - handle CacheClientResume/CacheClientSuspend off the main thread. r=gerald
MozReview-Commit-ID: GRbcNo7KtKH

--HG--
extra : rebase_source : 030c8808c7702dc8792b22250e3d414154014615
extra : source : 60d50a2829cde9ff2879270f983e23092ca9f426
2017-10-24 09:38:34 +08:00
JW Wang 7a1b18c3ec Bug 1411504. P3 - handle CacheClientSeek off the main thread for we will run Update() off the main thread. r=gerald
MozReview-Commit-ID: 7eavgwkTXx0

--HG--
extra : rebase_source : 26c5c1675281612e2753549839acb73f735b7bc8
extra : source : 42efd7bd8db58c5c42cc266d90100a7ec250ac15
2017-10-24 09:23:12 +08:00
JW Wang da256ca76e Bug 1411476. P5 - dump debug info for ChannelMediaResource. r=gerald
MozReview-Commit-ID: GjdtrlNb948

--HG--
extra : rebase_source : 248f4926435118ddc8baa0f901c5e4ec3f699c64
2017-10-25 13:57:39 +08:00
JW Wang e1a489f570 Bug 1405962. P2 - use thread-safe ref counting. r=gerald
These listeners will be AddRefed/Released off the main thread when
OMT data delivery is enabled.

MozReview-Commit-ID: CSOBgNNf3OW

--HG--
extra : rebase_source : d9085c6447e51d3aa9cad79fa1e25d986fdee792
extra : intermediate-source : 21be6f0003e6d3ccf4448e6574ea5d3122665155
extra : source : 8ce13766af359b5e55524e47ea74bcfc0e0133f8
2017-09-20 17:14:01 +08:00
Chris Pearce c16ed38cc5 Bug 1405697 - Move BaseMediaResource implementation into cpp file. r=jwwang
This means MediaResource.cpp now only contains the stuff for the MediaResource
super class, and MediaResourceIndex.

MozReview-Commit-ID: 5xFxibn0aJ4

--HG--
extra : rebase_source : 4cb940008abb62c43759689cdc9e034d25b7e36f
2017-10-04 20:34:07 +02:00
Chris Pearce 47c2e3ae92 Bug 1405697 - Move BaseMediaResource declaration to its own file. r=jwwang
This means we can simplify MediaResource.h to only include the abstract
interface, and MediaResourceIndex.

I also had to add a few includes here and there to fix the non-unified build.


MozReview-Commit-ID: 4R7LTXq25dm

--HG--
rename : dom/media/MediaResource.h => dom/media/BaseMediaResource.h
extra : rebase_source : edef4a65df4dcb92f8536052d170d78f95315753
2017-10-04 20:57:11 +02:00
Chris Pearce 53624e3480 Bug 1405697 - Move ChannelSuspendAgent to ChannelMediaResource.h. r=jwwang
It's only used by things in there anyway.

MozReview-Commit-ID: 4Pk12ab6e7U

--HG--
extra : rebase_source : ef9600770d6166fece0d1ae038d0b84cc87f1065
2017-10-04 16:35:11 +02:00
Chris Pearce 9f0aad7b2e Bug 1405697 - Move MediaChannelStatistics to its own file. r=jwwang
It currently resides in MediaResource.h, but it's only used in a
ChannelMediaDecoder and ChannelMediaResource, so it doesn't need to be in the
abstract header.


MozReview-Commit-ID: GskE5mjMav1

--HG--
extra : rebase_source : b42321ddcb1966d4de7203f04852c14f6d271acd
2017-10-04 16:30:32 +02:00
JW Wang 25f00c44db Bug 1401461. P1 - protect access to ChannelMediaResource::Listener::mResource. r=gerald
MozReview-Commit-ID: 6G1x7cXNvAq

--HG--
extra : rebase_source : 2f6a8642930ec314621aab2ce6424e4f9f95e0c2
extra : source : eeb067bc2905dfa6fb5764fd42ebb78e1b71a61d
2017-09-20 14:37:18 +08:00
Phil Ringnalda 1112382b61 Backed out 2 changesets (bug 1401461) for being the wrong patches
Backed out changeset 20a0000f97bc (bug 1401461)
Backed out changeset e3c36a62b5b1 (bug 1401461)

MozReview-Commit-ID: BJeIuoGJwjb
2017-09-21 20:29:39 -07:00
JW Wang f69d8e8e34 Bug 1401461. P1 - protect access to ChannelMediaResource::Listener::mResource. r=gerald
MozReview-Commit-ID: 6G1x7cXNvAq

--HG--
extra : rebase_source : 2f6a8642930ec314621aab2ce6424e4f9f95e0c2
extra : source : eeb067bc2905dfa6fb5764fd42ebb78e1b71a61d
2017-09-20 14:37:18 +08:00
Sebastian Hengst 17eaa88fb4 Backed out changeset 0ceb7e5789f4 (bug 1401461) for leaking in mochitest run on Windows 7 debug. r=backout 2017-09-21 11:16:40 +02:00
JW Wang 3ce1e10aba Bug 1401461. P1 - remove ChannelMediaResource::Listener::Revoke(). r=gerald
See comment 0 for the rationale. We check |aRequest != mResource->mChannel|
to know if a new channel is being loaded and the call should be aborted.

MozReview-Commit-ID: 6G1x7cXNvAq

--HG--
extra : rebase_source : 3114979192346e257f5d8040b8e0ffffa419d3f5
extra : source : eeb067bc2905dfa6fb5764fd42ebb78e1b71a61d
2017-09-20 14:37:18 +08:00
JW Wang 472ab4804d Bug 1399760. P3 - keep ID of the loading channel so we check whether the data callback is from an old channel. r=gerald
The load ID works as follows:
1. A load ID is passed to MediaCacheStream::NotifyDataStarted()
   when loading a new channel.
2. Each MediaCacheStream::NotifyDataReceived() call is also associated
   with a load ID from which the data is received.
3. If |mLoadID != aLoadID| tests to be true in NotifyDataReceived(), it means
   the data is from an old channel and should be discarded.
4. MediaCache::Update() reset mLoadID for the stream before calling
   CacheClientSeek() to prevent data from the old channel from being
   stored to the wrong position.

MozReview-Commit-ID: 9kBoublLlln

--HG--
extra : rebase_source : 58e6d3fe40ec7a549cabc70b30db8006b49c0563
2017-09-20 11:41:08 +08:00
JW Wang dd57b36053 Bug 1399760. P1 - remove the CopySegmentToCache() member function. r=gerald
MozReview-Commit-ID: 3D9RiK3PJUf

--HG--
extra : rebase_source : acf4962bb9fd4f784bbe5d13cc3428e7d60322d3
2017-09-20 11:12:48 +08:00
Andrea Marchesini 5f79fe9d48 Bug 1388125 - Move ChannelMediaResource to separate files, r=jya 2017-09-18 13:33:49 +02:00