Closed
Bug 1032652
Opened 11 years ago
Closed 7 years ago
Have a way for MediaDecoderReader to read MediaResource in an unblocking / asynchronous fashion.
Categories
(Core :: Audio/Video: Playback, defect, P2)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
INVALID
People
(Reporter: brsun, Assigned: bechen)
References
Details
Attachments
(1 file)
13.31 KB,
patch
|
cpearce
:
feedback-
|
Details | Diff | Splinter Review |
Current data-flow between MediaResource and MediaDecoderReader is through blocking read. It is good to have a unblocking / asynchronous reading mechanism to avoid blocking when MediaResource don't have enough data for MediaDecoderReader.
Comment 1•11 years ago
|
||
Do we still need this when MediaDecoderReader can work in async mode? Async MediaDecoderReader + sync MediaResource still provide async interfaces to the user of MediaDecoderReader. On the other hand, sync MediaDecoderReader + async MediaResource still provide sync interfaces.
Reporter | ||
Comment 2•11 years ago
|
||
If we don't want to waste any thread blocking on reading data from MediaResource, then there should be something we could do to improve this call-flow.
Comment 3•11 years ago
|
||
In fact, there is always a thread blocked waiting for data. It could be the caller thread or the internal thread of MediaResource that is waiting for data.
Reporter | ||
Comment 4•11 years ago
|
||
The intention of this bug is trying to avoid any blocking read in MediaDecoderReader.
If there are any threads necessary for waiting data (ex. inside MediaResource or necko), maybe we can
just keep it as usual. But if there are any threads waiting on other blocked threads (ex. blocking read between MediaDecoderReader and MediaResource), probably we could adapt another threading / buffering model to improve it.
Assignee | ||
Comment 5•11 years ago
|
||
I'm starting to evaluate what we need to do in this bug.
Assignee: nobody → bechen
Status: NEW → ASSIGNED
Assignee | ||
Comment 6•11 years ago
|
||
1. Create MediaTaskQueue for both video and audio.
2. Let decode thread returns immediately => the 2 new thread of MediaTaskQueue will do the "block decoding".
Now the patch is not stable, seek function is not work, sometimes the playback will stuck or crash.
Comment 7•11 years ago
|
||
If you want asynchronous decoding, you should implement MediaDecoderReader::RequestAudioData() and RequestVideoData() instead of the synchronous MediaDecoderReader::DecodeAudioData() and MediaDecoderReader::DecodeAudioFrame().
Then you can have async non-blocking decoding without having to cram it into a synchronous interface.
For am example, see the patch in bug 1032633, which I updated this morning.
Comment 8•11 years ago
|
||
Comment on attachment 8459387 [details] [diff] [review]
WIP-bug-1032652.v01.patch
Review of attachment 8459387 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/media/omx/MediaCodecReader.cpp
@@ +373,5 @@
> + return false;
> + }
> + aKeyframeSkip = false;
> + RefPtr<nsIRunnable> task =
> + NS_NewRunnableMethodWithArg<int64_t>(this,
This is bad, because the MediaDecoderStateMachine calls this (and DecodeAudioData) in a loop, so you'll end up dispatching many more of these events than you need, and burning through the CPU and battery.
Implement MediaDecoderReader::RequestAudioData and RequestVideoData to avoid that.
Attachment #8459387 -
Flags: feedback-
Updated•9 years ago
|
Component: Audio/Video → Audio/Video: Playback
Updated•7 years ago
|
Rank: 15
Priority: -- → P2
Comment 9•7 years ago
|
||
Patches here touch MediaCodecReader, which has been removed.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•