Commit Graph

88 Commits

Author SHA1 Message Date
Gerald Squelart
d86f260baa Bug 1371882 - Move MEDIACACHESTREAM_NOTIFIED_LENGTH telemetry collection to MediaCacheStream::Init - r=cpearce
The initial telemetry collection was done in NotifyDataLength() because that
was the first point where the length was introduced; but some extra code was
needed to ensure that were collecting the first length.
Now that this initial length is passed directly to Init(), we can report that
number instead.
In the "worst" case, it will actually be a bit more correct about what we
initially wanted to report, i.e., the initial length given by the HTTP
response header; and it's what we really want to know, now that we are using
this number to make a decision about which MediaCache to use.

MozReview-Commit-ID: 11Th8pensZt

--HG--
extra : rebase_source : 97a6d2dcbfad6c9b37819bfe6471baff2ec7e335
2017-06-12 14:27:46 +12:00
Gerald Squelart
9c6ad7eb88 Bug 1371882 - MediaCacheStream::Init forwards the known content length to the MediaCache factory - r=cpearce
This will give enough information (for now) for GetMediaCache to decide whether
to use the (one global shared) file-backed MediaCache, or a discrete memory-
backed MediaCache.
(Note that GetMediaCache doesn't use this length yet in this patch.)

MozReview-Commit-ID: 5B2E3sIsc4k

--HG--
extra : rebase_source : 940e782665bf2c3640bbe7389fca02ea7c1482cd
2017-06-08 15:59:43 +12:00
Gerald Squelart
023730a1ca Bug 1371882 - Make gMediaCache private inside MediaCache, to avoid misuse - r=cpearce
MozReview-Commit-ID: 6MyKmG7DNaG

--HG--
extra : rebase_source : 0e26d2e405166de8f0160a78faf4cf52fd68fa9e
2017-06-08 17:12:13 +12:00
Gerald Squelart
703d03eb67 Bug 1371882 - Delay MediaCache destruction if update queued - r=cpearce
MozReview-Commit-ID: LIjZFUIrTtX

--HG--
extra : rebase_source : a17ee8d9eb1c32c19e92b4a0ca71a037f32c8459
2017-06-08 16:45:21 +12:00
Gerald Squelart
420fc822c0 Bug 1371882 - Removed unnecessary gMediaCache-> from MediaCache member functions - r=cpearce
MozReview-Commit-ID: BKjH9hfoL5g

--HG--
extra : rebase_source : d83836ad127895197fba32cd69d282fe9b1c27df
2017-06-08 16:20:37 +12:00
Gerald Squelart
d63ca8dd12 Bug 1371882 - MediaCacheStream::mInitialized is redundant, mMediaCache is non-null after initialization - r=cpearce
MozReview-Commit-ID: 6VIPMLmzuEP

--HG--
extra : rebase_source : 80df4e3bda168660812d420e26c6117c7ccc4b88
2017-06-09 13:48:06 +12:00
Gerald Squelart
fc0f5efec9 Bug 1371882 - MediaCacheStream accesses its MediaCache through a member pointer - r=cpearce
MozReview-Commit-ID: CM1rXqAc4FT

--HG--
extra : rebase_source : a4eaadb9c4bd40034e16a811878cf7663b6a66ce
2017-06-08 17:30:40 +12:00
Gerald Squelart
54ab31eb36 Bug 1371882 - MediaCache::constructor/destructor/Init() don't need to be public - r=cpearce
MozReview-Commit-ID: 9naYvPbGn14

--HG--
extra : rebase_source : d1116e03d4bbef1c6bd1a6be676eb89605a78494
2017-06-09 12:53:11 +12:00
Gerald Squelart
901a3dbeea Bug 1371882 - static MediaCache::GetMediaCache to get file-backed MediaCache - r=cpearce
This is the new recommended way to create&initialize the file-backed
MediaCache.

In future patches, this will also allow the creation of memory-backed
MediaCache objects.

MozReview-Commit-ID: 6RUlNW2eBPP

--HG--
extra : rebase_source : 0b3e6fae71207076812b5cb9172d4497d3e68ea2
2017-06-08 15:09:40 +12:00
Gerald Squelart
2bfadd1441 Bug 1371882 - MediaCache::ResourceStreamIterator is given the MediaCache to work with - r=cpearce
MozReview-Commit-ID: 3Xl4WNESdnY

--HG--
extra : rebase_source : d69d52c68512041dd61c5782e3406aa66a487a28
2017-06-08 15:32:13 +12:00
Gerald Squelart
fca2c5bdbd Bug 1371882 - MediaCacheFlusher allows for multiple MediaCache's - r=cpearce
MediaCacheFlusher constructs itself when needed by the first MediaCache, and
destroys itself when the last MediaCache unregisters itself.

Some MediaCache member functions had to be made non-static, so they could be
called for each instance.

MozReview-Commit-ID: 5Dh9mEKbZHg

--HG--
extra : rebase_source : 1570e30787ba486f9436b4b05aa3cfa0329d1ee7
2017-06-08 14:32:13 +12:00
Mats Palmgren
a74a8a2035 Bug 1371953 - Avoid unnecesary hashtable lookups by using RemoveEntry(EntryType*) rather than RemoveEntry(key) in a couple of places. r=gerald
MozReview-Commit-ID: 8Uu9QX4QhRi
2017-06-14 01:54:26 +02:00
Gerald Squelart
0fa477a0cd Bug 1371205 - MEDIACACHESTREAM_NOTIFIED_LENGTH captures the HTTP header length given to MediaCacheStream - r=cpearce,francois
MozReview-Commit-ID: 9muZcpfD2vG

--HG--
extra : rebase_source : 11de88ac8f0788c3e04ef206bcdacc4ef112a139
2017-06-08 20:26:24 +12:00
Gerald Squelart
41b2a8ff81 Bug 1369538 - Telemetry MEDIACACHESTREAM_LENGTH_KB - r=cpearce,francois
Capture each media stream's length (as provided, otherwise as actually
downloaded), to gauge whether keeping media in memory would have a significant
impact.

MozReview-Commit-ID: 4yUQrbgLcGG

--HG--
extra : rebase_source : bed0ea1d58f864463926478b0f8ea59e7084c4af
2017-06-02 10:43:45 +12:00
Carsten "Tomcat" Book
72ff833516 Backed out changeset 12e990a89018 (bug 1369538) for causing new intermittent leak in browser_devices_get_user_media_in_frame.js 2017-06-02 10:37:59 +02:00
Gerald Squelart
dbea6f45b8 Bug 1369538 - Telemetry MEDIACACHESTREAM_LENGTH_KB - r=cpearce,francois
Capture each media stream's length (as provided, otherwise as actually
downloaded), to gauge whether keeping media in memory would have a significant
impact.

MozReview-Commit-ID: 4yUQrbgLcGG

--HG--
extra : rebase_source : bed0ea1d58f864463926478b0f8ea59e7084c4af
2017-06-02 10:43:45 +12:00
Gerald Squelart
4d566af858 Bug 1366936 - Telemetry: Watermark of number of block owners during MediaCache sessions - r=cpearce,francois
MozReview-Commit-ID: Ed1Eah9TuSJ

--HG--
extra : rebase_source : b539ba0f551c821d0b093435f0fdba958ecd3aaa
2017-05-23 14:59:16 +12:00
Gerald Squelart
8183f3fe78 Bug 1366929 - Telemetry: Watermark (in KB) reached by each MediaCache session - r=cpearce
MozReview-Commit-ID: 6BDFFYq1JnJ

--HG--
extra : rebase_source : dd67c472369d3c0db714333e1eb9f7c665514b17
2017-05-23 14:44:06 +12:00
JW Wang
c6c155a08e Bug 1364001. P1 - add an API to throttle download. r=cpearce
MozReview-Commit-ID: HdmAgvo1GE3

--HG--
extra : rebase_source : 97f0aa3e40c6c774ad7681ee2aae69393c47e741
extra : intermediate-source : 9f2e1751e19f88625d2a89dba0b1648f97d2478f
extra : source : b68fed514292e5e8c7815633052daeee24f64a95
2017-05-11 16:49:36 +08:00
JW Wang
69b3ff3c30 Bug 1358726 - fix the assertion failure in AllocateAndWriteBlock(). r=gerald
block->mOwners might be empty if all streams for the resource id are
closed. We don't bother write the data to the cache since there is no
stream to use it.

MozReview-Commit-ID: KKiyZqLBjim

--HG--
extra : rebase_source : 7fa0a6d841dff91dd7142aac5a336b950342ac67
2017-04-23 21:18:07 +08:00
JW Wang
57f154251e Bug 1357244. P2 - enforce the invariant that a block is in mFreeBlocks iff it has no owners. r=gerald
http://searchfox.org/mozilla-central/rev/4bd7a206dea5382c97a8a0c30beef668cc449f5b/dom/media/MediaCache.cpp#1529
Note we might return here with mOwners is empty and break the invariant.

MozReview-Commit-ID: JC5OtEU0B8O

--HG--
extra : rebase_source : f842601db12e047fd73a9b062612da2f2b7c0263
2017-04-18 10:44:38 +08:00
JW Wang
e82ac126f4 Bug 1357244. P1 - use stronger assertions to debug non-debug builds. r=gerald
MozReview-Commit-ID: 8QK7vawpoIQ

--HG--
extra : rebase_source : f1b47b3607c0c03d2ad7c4d0ada3b89304780054
2017-04-18 10:23:56 +08:00
JW Wang
02d7482da7 Bug 1355719 - Use shorter names for logging macros in MediaCache. r=kaku
MozReview-Commit-ID: GY6o1xBu0wO

--HG--
extra : rebase_source : 51ef1d40222564b17218db5240cdbb30df9175fc
extra : source : 11cb40d76dbe3163d1620aea3de9eec82f3e25a0
2017-04-12 14:51:34 +08:00
JW Wang
1430347b77 Bug 1355406 - Change the type of MediaCacheStream::mPartialBlockBuffer to UniquePtr<uint8_t[]>. r=jya
UniquePtr<uint8_t[]> has the same alignment as UniquePtr<int64_t[]> for the
underlying buffer. It also allows us to remove some reinterpret_casts.

MozReview-Commit-ID: 8V1lZdayFQv

--HG--
extra : rebase_source : 61f1943b9f3e464b47865fb0fff2742125f4c688
extra : intermediate-source : 329adb8a4414f32e2f83ba79af06d288d7b25705
extra : source : ba967b187b9dbc8f402db90272f55b9ee9d92692
2017-04-11 16:52:38 +08:00
JW Wang
e6d11e2bb5 Bug 1355393. P2 - write the bytes out when we've collected a whole block. r=cpearce
MozReview-Commit-ID: 3kAk235rZig

--HG--
extra : rebase_source : e7bcb0be101dbe4d3c95140673086e8396ac1b8f
extra : source : f35e9f125bb38c39e093d8958115708cc3dd4487
2017-04-11 16:06:08 +08:00
JW Wang
52344be7f1 Bug 1355393. P1 - let FileBlockCache::WriteBlock() take 2 buffers instead of one. r=cpearce
This allows us to save copies in combining 2 bufffers into one before calling
FileBlockCache::WriteBlock().

MozReview-Commit-ID: 62kQIxp3Ju0

--HG--
extra : rebase_source : a64c160b9ab3d7bbd724be053fea6358ae7885df
extra : source : f699fdb6fdaf1fd5b4dfeb394928c95e33853a53
2017-04-11 15:47:46 +08:00
JW Wang
3b2675d90b Bug 1354389. P3 - fix the callers to handle changes when dropping the monitor. r=cpearce
No change is needed for MediaCacheStream::Read() which calls |mon.Wait()|
and has handled changes when dropping the monitor.

MozReview-Commit-ID: 40h0cHn1WFx

--HG--
extra : rebase_source : 5447339ed7751f3171458d8e5fb1e5f6fe3a786e
2017-04-10 13:57:13 +08:00
JW Wang
64b0fbf69a Bug 1354389. P2 - remove the unused function. r=cpearce
MozReview-Commit-ID: 4Mx89MxJmVO

--HG--
extra : rebase_source : 0427e7597dcf7087485945fd283e91e81de9b912
2017-04-10 11:56:35 +08:00
JW Wang
8a3ec7649b Bug 1354389. P1 - drop the monitor before doing IO. r=cpearce
We don't want to do IO while holding the monitor which might be acquired
on the main thread in MediaCache::Update().

MozReview-Commit-ID: 4cHM35K8Twb

--HG--
extra : rebase_source : 5a00332933abd1812f64fa57c9f5e2947ec979ae
2017-04-10 11:55:26 +08:00
JW Wang
d64d62164c Bug 1194891. P4 - close all streams associated with private browsing windows when PB is done. r=cpearce
MozReview-Commit-ID: MmvMuzuFX3

--HG--
extra : rebase_source : d5f98bd815323e9a79959af49a9585d8f6108d28
extra : source : 7a82be361a50b950b579a5f6b1872d10de80d76f
2017-04-06 16:39:14 +08:00
JW Wang
09e1217347 Bug 1194891. P2 - don't write any data for a closed stream. r=cpearce
MozReview-Commit-ID: 3buPoKxVXbH

--HG--
extra : rebase_source : d28ade4b90d63deb386e4922b3a1251dfd878a31
extra : source : dd4013c9d706212cad669a1fe124af03beb4a32e
2017-04-06 16:24:44 +08:00
JW Wang
84734bb3c0 Bug 1194891. P1 - plumb 'isPrivateBrowsing' down to MediaCacheStream. r=cpearce
MozReview-Commit-ID: EBKkOfK7K1p

--HG--
extra : rebase_source : 82daa16ffa0809a4de660867ab61d9a9efdf2a83
extra : source : b61d0c22837a6ee8085c95afbd1370ffa8286e6e
2017-04-06 16:20:00 +08:00
Chris Pearce
cabb78f52e Bug 1347031 - Move the MediaCache off of opening its temporary file fd synchronously in the content process. r=jwwang
In bug 1346987 we're attempting to remove uses of the
NS_OpenAnonymousTemporaryFile() in the content process as it sends a
synchronous IPC to the parent process on the main thread, which can cause UI
jank. This patch makes the MediaCache use the async anonymous temporary file
creation function added in bug 1346987.

The file descriptor is held by the FileBlockCache. This object buffers data
passed to it in memory, and defers writing of said data to another thread. I
added the async wait for the file descriptor to be inside that async "defer to
other thread" step.

This means that while the content process is waiting for the file descriptor to
come down from the parent process, we'll buffer media data being streamed in
memory. Given that our MSE implementation will buffer up to 100MB of media data
in memory anyway, it seems that more buffering in the src=url case while we
wait for an async IPC to do a round trip to the main process is acceptable.

MozReview-Commit-ID: 3OTBTWw5pr0

--HG--
extra : rebase_source : 56e0a1f1473db3c9722330254f7a4bf3a1f5caa3
2017-03-17 09:54:23 +13:00
Kaku Kuo
6b504ea575 Bug 1344654 - Label runnables in dom/media/MediaCache.cpp; r=jwwang
MozReview-Commit-ID: LU5rdu3Zx48

--HG--
extra : rebase_source : 1ffdfe8389381de746314acb52c0074fb6c22290
2017-03-06 17:45:41 +08:00
Tom Tromey
5f8f360823 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs

--HG--
extra : rebase_source : 2f1f0aa12493c44f352d9a7e8683e7bb72d2d75b
2016-12-15 20:16:31 -07:00
Jean-Yves Avenard
b7844bd5c3 Bug 1319987: P9. More coding style fixes. r=gerald
MozReview-Commit-ID: DhFRqkWQZny

--HG--
extra : rebase_source : 03ed44efc83fe9cab7fc975229ac4e5746aff96b
2017-01-27 13:20:37 +01:00
JW Wang
9b83914222 Bug 1322087. Part 3 - allow MediaResoure::Tell() to be called on the main thread. r=cpearce
It is safe to call Tell() on the main thread because it won't block the main thread like Read() does.

MozReview-Commit-ID: 64B41l8fe1

--HG--
extra : rebase_source : b5fc0ec44e8c238841c4f4329d14a0e476f7e422
extra : source : 3d229e2cc659d262ce04c4b09b3484b6524af4b4
2016-12-07 03:22:32 -10:00
Nicholas Nethercote
b71747b2ac Bug 1299727 - Rename NS_WARN_IF_FALSE as NS_WARNING_ASSERTION. r=erahm.
The new name makes the sense of the condition much clearer. E.g. compare:

  NS_WARN_IF_FALSE(!rv.Failed());

with:

  NS_WARNING_ASSERTION(!rv.Failed());

The new name also makes it clearer that it only has effect in debug builds,
because that's standard for assertions.

--HG--
extra : rebase_source : 886e57a9e433e0cb6ed635cc075b34b7ebf81853
2016-09-01 15:01:16 +10:00
JW Wang
60c4b69563 Bug 1293940 - fix uninitialized members. r=gerald
MozReview-Commit-ID: 8QRGKowJiYC

--HG--
extra : rebase_source : 0f38f004f22b1a5cf81b842c843c23fdec41e939
2016-08-10 15:04:39 +08:00
JW Wang
296eb5268a Bug 1290318 - listen to "cacheservice:empty-cache" to clear media cache. r=mayhemer
MozReview-Commit-ID: 7t4FPCxOUYl

--HG--
extra : rebase_source : 3c10840d2559e7fb2db47cbb3c439a7a8ddc5792
2016-08-08 11:04:55 +08:00
Nicholas Nethercote
e7f10a07fd Bug 1293603 (part 2) - Make Run() declarations consistent. r=erahm.
This patch makes most Run() declarations in subclasses of nsIRunnable have the
same form: |NS_IMETHOD Run() override|.

As a result of these changes, I had to add |override| to a couple of other
functions to satisfy clang's -Winconsistent-missing-override warning.

--HG--
extra : rebase_source : 815d0018b0b13329bb5698c410f500dddcc3ee12
2016-08-08 12:18:10 +10:00
Kyle Huey
c73656947b Bug 1265927: Move nsRunnable to mozilla::Runnable, CancelableRunnable to mozilla::CancelableRunnable. r=froydnj 2016-04-25 17:23:21 -07:00
JW Wang
ed30277439 Bug 1258673. Part 2 - since mStreamOffset is not updated until the end of MediaCacheStream::Read(), we have to pass stream offset to MediaCache::NoteBlockUsage explicitly to avoid hitting the assertion. r=jya. 2016-03-24 14:59:33 +08:00
JW Wang
b5553c6b2b Bug 1258673. Part 1 - cache mStreamOffset so we won't read at the wrong position when Other Read() interrupt the current Read(). r=jya. 2016-03-23 21:40:18 +08:00
Birunthan Mohanathas
d7371d07d0 Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-02-02 17:36:30 +02:00
Phil Ringnalda
d381b4bca6 Back out 7 changesets (bug 1235261) for cpptest failures in TestTArray
CLOSED TREE

Backed out changeset d66c3f19a210 (bug 1235261)
Backed out changeset 467d945426bb (bug 1235261)
Backed out changeset 32b61df13142 (bug 1235261)
Backed out changeset c50bb8ed4196 (bug 1235261)
Backed out changeset 0ff0fa6fe81f (bug 1235261)
Backed out changeset df70e89669da (bug 1235261)
Backed out changeset 064969357fc9 (bug 1235261)
2016-01-31 10:10:57 -08:00
Birunthan Mohanathas
373593275e Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-01-31 17:12:12 +02:00
Nathan Froyd
ffeb7c7fe3 Bug 1229963 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in dom/media/; r=cpearce 2015-12-02 18:07:59 -05:00
Jean-Yves Avenard
c8c275cee2 Bug 1227396: P7. Replace nsTArray<MediaByteRange> with dedicated MediaByteRangeSet object. r=cpearce 2015-11-30 11:29:34 +11:00
Birunthan Mohanathas
399934f259 Bug 1217307 - Remove some unnecessary null checks in rest of dom/. r=njn 2015-11-19 09:13:49 +02:00