Closed
Bug 1201393
Opened 9 years ago
Closed 9 years ago
Remove use of FLAG_BLOCK_INPUT/FLAG_BLOCK_OUTPUT
Categories
(Core :: Audio/Video: MediaStreamGraph, defect)
Core
Audio/Video: MediaStreamGraph
Tracking
()
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: roc, Assigned: roc)
References
(Blocks 1 open bug)
Details
Attachments
(8 files)
(deleted),
text/x-review-board-request
|
jwwang
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
jwwang
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
jwwang
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
jwwang
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
eeejay
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
karlt
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
padenot
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
padenot
:
review+
|
Details |
No description provided.
Assignee | ||
Comment 1•9 years ago
|
||
I'm also going to remove some cases of explicit blocking here.
Assignee | ||
Comment 2•9 years ago
|
||
Bug 1201393. Remove usage of FLAG_BLOCK_* from OutputStreamData::Connect. r=jwwang
We don't want to block stream decoding on the output MediaStream, or vice
versa.
Attachment #8656385 -
Flags: review?(jwwang)
Assignee | ||
Comment 3•9 years ago
|
||
Bug 1201393. Remove usage of FLAG_BLOCK_OUTPUT from MediaRecorder. r=jwwang
Blocking on the source stream will be treated as silence/no video change.
Attachment #8656386 -
Flags: review?(jwwang)
Assignee | ||
Comment 4•9 years ago
|
||
Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from MediaRecorder. r=jwwang
FLAG_BLOCK_INPUT is not needed on mPipeStream because nothing should cause
mPipeStream to block.
Attachment #8656387 -
Flags: review?(jwwang)
Assignee | ||
Comment 5•9 years ago
|
||
Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from MediaStreamAudioSourceNode. r=jwwang
There's no reason why WebAudio should block an incoming MediaStream.
Attachment #8656388 -
Flags: review?(jwwang)
Assignee | ||
Comment 6•9 years ago
|
||
Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot
Attachment #8656389 -
Flags: review?(padenot)
Assignee | ||
Comment 7•9 years ago
|
||
Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from AudioParam/AudioNode. r=padenot
We don't need AudioNodes to block each other anymore.
Attachment #8656390 -
Flags: review?(padenot)
Assignee | ||
Comment 8•9 years ago
|
||
Bug 1201393. Remove explicit blocking when generating a MediaStream from a media element. r=jwwang
Since we're not trying to eliminate "dead air" from the generated stream
anymore, there's no need for this blocking code.
Attachment #8656391 -
Flags: review?(jwwang)
Assignee | ||
Comment 9•9 years ago
|
||
Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
Attachment #8656392 -
Flags: review?(karlt)
Comment 10•9 years ago
|
||
Comment on attachment 8656385 [details]
MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_* from OutputStreamData::Connect. r=jwwang
https://reviewboard.mozilla.org/r/18169/#review16259
Attachment #8656385 -
Flags: review?(jwwang) → review+
Comment 11•9 years ago
|
||
Comment on attachment 8656386 [details]
MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_OUTPUT from MediaRecorder. r=jwwang
https://reviewboard.mozilla.org/r/18171/#review16261
Attachment #8656386 -
Flags: review?(jwwang) → review+
Comment 12•9 years ago
|
||
Comment on attachment 8656387 [details]
MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from MediaRecorder. r=jwwang
https://reviewboard.mozilla.org/r/18173/#review16263
Attachment #8656387 -
Flags: review?(jwwang) → review+
Comment 13•9 years ago
|
||
Comment on attachment 8656388 [details]
MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from MediaStreamAudioSourceNode. r=jwwang
https://reviewboard.mozilla.org/r/18175/#review16265
Attachment #8656388 -
Flags: review?(jwwang) → review+
Comment 14•9 years ago
|
||
Comment on attachment 8656391 [details]
MozReview Request: Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot
https://reviewboard.mozilla.org/r/18181/#review16267
Attachment #8656391 -
Flags: review?(jwwang) → review+
Comment 15•9 years ago
|
||
Since blocking is removed, the position reported by DecodedStream::GetPosition() will keep increasing even when the media element is paused, right? How will HTMLMediaElement.currentTime handle this after it is resumed from pause?
Assignee | ||
Comment 16•9 years ago
|
||
You're quite right, that's a bug in attachment 8656391 [details]. I'll just drop that patch out for now.
Assignee | ||
Updated•9 years ago
|
Attachment #8656391 -
Flags: review+ → review-
Assignee | ||
Comment 17•9 years ago
|
||
Comment on attachment 8656389 [details]
MozReview Request: Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
Attachment #8656389 -
Attachment description: MozReview Request: Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot → MozReview Request: Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
Assignee | ||
Comment 18•9 years ago
|
||
Comment on attachment 8656390 [details]
MozReview Request: Bug 1201393. Create an iterator for MediaStreamGraph to iterate over all its streams. r=karlt
Bug 1201393. Create an iterator for MediaStreamGraph to iterate over all its streams. r=karlt
Attachment #8656390 -
Attachment description: MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from AudioParam/AudioNode. r=padenot → MozReview Request: Bug 1201393. Create an iterator for MediaStreamGraph to iterate over all its streams. r=karlt
Attachment #8656390 -
Flags: review?(padenot) → review?(karlt)
Assignee | ||
Updated•9 years ago
|
Attachment #8656391 -
Attachment description: MozReview Request: Bug 1201393. Remove explicit blocking when generating a MediaStream from a media element. r=jwwang → MozReview Request: Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot
Attachment #8656391 -
Flags: review?(padenot)
Attachment #8656391 -
Flags: review?(jwwang)
Attachment #8656391 -
Flags: review-
Assignee | ||
Comment 19•9 years ago
|
||
Comment on attachment 8656391 [details]
MozReview Request: Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot
Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot
To make this work, we have to iterate over suspended MediaStreams in a few
more places. We don't need START_TIME_DELAYED anymore since blocking takes
care of that. I think it's good to allow suspended MediaStreams to notify
the main thread that they're finished; we might need that later when
we have non-AudioNode streams being suspended.
Assignee | ||
Updated•9 years ago
|
Attachment #8656392 -
Attachment description: MozReview Request: Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan → MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from AudioParam/AudioNode. r=padenot
Attachment #8656392 -
Flags: review?(karlt) → review?(padenot)
Assignee | ||
Comment 20•9 years ago
|
||
Comment on attachment 8656392 [details]
MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from AudioParam/AudioNode. r=padenot
Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from AudioParam/AudioNode. r=padenot
We don't need AudioNodes to block each other anymore.
Assignee | ||
Comment 21•9 years ago
|
||
Comment on attachment 8656389 [details]
MozReview Request: Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
Attachment #8656389 -
Flags: review?(padenot) → review?(eitan)
Assignee | ||
Updated•9 years ago
|
Attachment #8656391 -
Flags: review?(jwwang)
Assignee | ||
Comment 22•9 years ago
|
||
Comment 23•9 years ago
|
||
Comment on attachment 8656389 [details]
MozReview Request: Bug 1201393. Remove irrelevant ProcessedMediaStream for nsSpeechTask. r=eitan
https://reviewboard.mozilla.org/r/18177/#review16317
I'm fine with this patch, although I would have done it a bit differently.
::: dom/media/webspeech/synth/nsSpeechTask.h:52
(Diff revision 2)
> + void InitIndirectAudio();
It seems like this could still be one function with a boolean argument.
::: dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp:772
(Diff revision 2)
> - if (!mStream) {
> + aTask->InitDirectAudio();
If this was one function, there would be no need for if/else, but simply passing `serviceType == nsISpeechService::SERVICETYPE_INDIRECT_AUDIO` as an argument.
Attachment #8656389 -
Flags: review?(eitan) → review+
Assignee | ||
Comment 24•9 years ago
|
||
(In reply to Eitan Isaacson [:eeejay] from comment #23)
> I'm fine with this patch, although I would have done it a bit differently.
Thanks.
Generally I think we try to avoid functions taking boolean parameters. They're hard to read at the call site, although not in this case I guess.
Comment 25•9 years ago
|
||
https://reviewboard.mozilla.org/r/18181/#review16375
::: dom/media/MediaStreamGraph.cpp
(Diff revision 2)
> - if (!stream->IsSuspended()) {
> - bool streamHasOutput = blockedTime < aNextCurrentTime - aPrevCurrentTime;
> + bool streamHasOutput = blockedTime < aNextCurrentTime - aPrevCurrentTime;
> - NS_ASSERTION(!streamHasOutput || !stream->mNotifiedFinished,
> + NS_ASSERTION(!streamHasOutput || !stream->mNotifiedFinished,
> - "Shouldn't have already notified of finish *and* have output!");
> + "Shouldn't have already notified of finish *and* have output!");
>
> - if (streamHasOutput) {
> + if (streamHasOutput) {
> - StreamNotifyOutput(stream);
> + StreamNotifyOutput(stream);
> - }
> + }
>
> - if (stream->mFinished && !stream->mNotifiedFinished) {
> + if (stream->mFinished && !stream->mNotifiedFinished) {
> - StreamReadyToFinish(stream);
> + StreamReadyToFinish(stream);
> - }
> + }
I assume that mFinished won't change on suspended streams. Is stream time advancing on suspended streams so that GetAllTracksEnd() might be reached in StreamReadyToFinish()?
If not, then the only reason to process main thread updates on suspended streams is the fact that updates are not dispatched each iteration?
Comment 26•9 years ago
|
||
Comment on attachment 8656390 [details]
MozReview Request: Bug 1201393. Create an iterator for MediaStreamGraph to iterate over all its streams. r=karlt
https://reviewboard.mozilla.org/r/18179/#review16373
The changes here are good if you can avoid IsSuspended(), thanks.
::: dom/media/MediaStreamGraph.cpp:393
(Diff revision 2)
> - if (runningAndSuspendedPair[array] == &mStreams) {
> + if (!stream->IsSuspended()) {
I don't see IsSuspended() declared at
http://reviewboard-hg.mozilla.org/gecko/file/4248871f6cd7/dom/media/MediaStreamGraph.h
Looks like this will be removed in
https://reviewboard.mozilla.org/r/18181/diff/2
so move UpdateCurrentTimeForStreams() changes to that patch to avoid using IsSuspended(), but see my question on that patch.
::: dom/media/MediaStreamGraphImpl.h:555
(Diff revision 2)
> + nsTArray<MediaStream*>* Array()
> + {
> + return mArrayNum == 0 ? &mGraph->mStreams : &mGraph->mSuspendedStreams;
> + }
Can you make Array() private, please, to clarify that it is just part of the implementation?
The member variables can also be private.
::: dom/media/MediaStreamGraphImpl.h:577
(Diff revision 2)
> + StreamSet Streams() { return StreamSet(*this); }
Streams() returns different streams from what are in mStreams, so I wonder about calling this all streams, but then maybe it would be better to rename mStreams to mRunningStreams, which is a different issue.
Attachment #8656390 -
Flags: review?(karlt) → review+
Assignee | ||
Comment 27•9 years ago
|
||
Try green on Linux debug.
Assignee | ||
Comment 28•9 years ago
|
||
https://reviewboard.mozilla.org/r/18179/#review16373
> I don't see IsSuspended() declared at
> http://reviewboard-hg.mozilla.org/gecko/file/4248871f6cd7/dom/media/MediaStreamGraph.h
>
> Looks like this will be removed in
> https://reviewboard.mozilla.org/r/18181/diff/2
> so move UpdateCurrentTimeForStreams() changes to that patch to avoid using IsSuspended(), but see my question on that patch.
Good idea.
> Can you make Array() private, please, to clarify that it is just part of the implementation?
> The member variables can also be private.
Sure
> Streams() returns different streams from what are in mStreams, so I wonder about calling this all streams, but then maybe it would be better to rename mStreams to mRunningStreams, which is a different issue.
Sure, I'll rename it to AllStreams.
Assignee | ||
Comment 29•9 years ago
|
||
https://reviewboard.mozilla.org/r/18179/#review16373
> Good idea.
Actually to fix this more simply without getting tangled up with other changes, I just split the loop so that the !IsSuspended work is done in a separate loop over mStreams.
Assignee | ||
Comment 30•9 years ago
|
||
https://reviewboard.mozilla.org/r/18179/#review16373
> Actually to fix this more simply without getting tangled up with other changes, I just split the loop so that the !IsSuspended work is done in a separate loop over mStreams.
No I won't, that doesn't work. I'll replace !IsSuspended with mSuspendedStreams.IndexOf(stream) == mSuspendedStreams.NoIndex.
Assignee | ||
Comment 31•9 years ago
|
||
(In reply to Karl Tomlinson (ni?:karlt) from comment #25)
> I assume that mFinished won't change on suspended streams. Is stream time
> advancing on suspended streams so that GetAllTracksEnd() might be reached in
> StreamReadyToFinish()?
That's one possibility.
> If not, then the only reason to process main thread updates on suspended
> streams is the fact that updates are not dispatched each iteration?
That's also a potential issue.
Basically I don't want to have to think about this too much. Skipping updates on suspended streams is fragile when it's non-obvious, and here I don't think it's obvious. Also keep in mind that most AudioNodes already suppress main-thread updates so those suspended nodes we notify on shouldn't cost us much.
Comment 32•9 years ago
|
||
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #30)
> https://reviewboard.mozilla.org/r/18179/#review16373
>
> > Actually to fix this more simply without getting tangled up with other changes, I just split the loop so that the !IsSuspended work is done in a separate loop over mStreams.
>
> No I won't, that doesn't work. I'll replace !IsSuspended with
> mSuspendedStreams.IndexOf(stream) == mSuspendedStreams.NoIndex.
I'm keen to avoid new n^2 costs involving suspended streams.
If this is being removed in the next patch, then it doesn't matter.
But I expect it is better to have no test than a test that makes this n^2.
Comment 33•9 years ago
|
||
Comment on attachment 8656392 [details]
MozReview Request: Bug 1201393. Remove usage of FLAG_BLOCK_INPUT from AudioParam/AudioNode. r=padenot
https://reviewboard.mozilla.org/r/18183/#review16515
Attachment #8656392 -
Flags: review?(padenot) → review+
Comment 34•9 years ago
|
||
Comment on attachment 8656391 [details]
MozReview Request: Bug 1201393. Make suspended MediaStreams implicitly always block. r=padenot
https://reviewboard.mozilla.org/r/18181/#review16517
Attachment #8656391 -
Flags: review?(padenot) → review+
Updated•9 years ago
|
Component: Audio/Video → Audio/Video: MSG/cubeb/GMP
Assignee | ||
Comment 35•9 years ago
|
||
(In reply to Karl Tomlinson (ni?:karlt) from comment #32)
> But I expect it is better to have no test than a test that makes this n^2.
We already have that in UpdateStreamOrder, which calls StreamSuspended in a couple of places during its loop. Note that the O(N^2) cost is only when AudioContext.suspend/resume are being used, and I have patches to get rid of this.
Assignee | ||
Comment 36•9 years ago
|
||
Comment 37•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/05bae6d384d9
https://hg.mozilla.org/integration/mozilla-inbound/rev/75832092cd8d
https://hg.mozilla.org/integration/mozilla-inbound/rev/e3c818c29872
https://hg.mozilla.org/integration/mozilla-inbound/rev/0f56b9b904a2
https://hg.mozilla.org/integration/mozilla-inbound/rev/fcc8220b9561
https://hg.mozilla.org/integration/mozilla-inbound/rev/2d0794169172
https://hg.mozilla.org/integration/mozilla-inbound/rev/61079e59ef35
https://hg.mozilla.org/integration/mozilla-inbound/rev/321303b7d428
Comment 38•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/05bae6d384d9
https://hg.mozilla.org/mozilla-central/rev/75832092cd8d
https://hg.mozilla.org/mozilla-central/rev/e3c818c29872
https://hg.mozilla.org/mozilla-central/rev/0f56b9b904a2
https://hg.mozilla.org/mozilla-central/rev/fcc8220b9561
https://hg.mozilla.org/mozilla-central/rev/2d0794169172
https://hg.mozilla.org/mozilla-central/rev/61079e59ef35
https://hg.mozilla.org/mozilla-central/rev/321303b7d428
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in
before you can comment on or make changes to this bug.
Description
•