Closed
Bug 1375411
Opened 7 years ago
Closed 7 years ago
[Android] cubeb doesn't call drain when playing specific file
Categories
(Core :: Audio/Video: cubeb, defect, P1)
Tracking
()
RESOLVED
FIXED
People
(Reporter: alwu, Assigned: alwu)
References
()
Details
Attachments
(3 files)
Fork from bug1374956 comment4, the audio would never end when playing the "very-short.mp3".
This issue can be reproduced on Nexus5 with Android 6.0 and Z3C with Android 5.1.
---
You have two reproduce ways,
Method-A :
Run mochitest dom/media/test/test_playback_rate.html, and then you would see the timeout.
Method-B :
STR.
1. goto the page https://people-mozilla.org/~alwu/playbackRate.html
2. change the playback rate of "very-short.mp3" (arbitrary rate, but not 1)
3. play the audio
Expect.
4. audio end
Actual.
4. audio doesn't end
Note : the page has another normal audio, but it won't have this symptom. It can end successfully even you change its playback rate.
Assignee | ||
Comment 1•7 years ago
|
||
Hi, Paul,
Could you help me take a look about this issue?
Thanks!
Flags: needinfo?(padenot)
Comment 2•7 years ago
|
||
I will take this one since I have done the latest work in OpenSL ES backend. I will try to repro later today. It's been a while from last time I built for Android.
Flags: needinfo?(padenot) → needinfo?(achronop)
Updated•7 years ago
|
Rank: 15
Priority: -- → P1
Comment 4•7 years ago
|
||
If this issue happens only after changing playback rate, you can add some logs to AudioStream::GetTimeStretched() to see if there is anything abnormal.
Flags: needinfo?(jwwang)
Comment 5•7 years ago
|
||
In case you have a build ready could you capture logs with cubeb flag on (cubeb:5)? I see you have already logs (without cubeb though) in Bug 1374956#c4.
Flags: needinfo?(alwu)
Assignee | ||
Comment 6•7 years ago
|
||
Here is the log.
It seems that the cubeb doesn't finish draining?
Flags: needinfo?(alwu)
Assignee | ||
Comment 7•7 years ago
|
||
This is the case that the media can end successfully.
In this case, we don't change its playback rate (rate=1).
Comment 8•7 years ago
|
||
(In reply to Alastor Wu [:alwu][please needinfo? me] from comment #6)
> Created attachment 8881467 [details]
> Log with Cubeb_OpenSL
>
> Here is the log.
> It seems that the cubeb doesn't finish draining?
When draining starts, cubeb_opensl calls SetMarkerPosition() and wait for the callback at [2] to ensure all data are consumed by the player before notifying DRAINED. It looks like there is something in the calculation of |written_duration| such that the player will never reach the position.
[1] http://searchfox.org/mozilla-central/rev/fdb811340ac4e6b93703d72ee99217f3b1d250ac/media/libcubeb/src/cubeb_opensl.c#326-335
[2] http://searchfox.org/mozilla-central/rev/fdb811340ac4e6b93703d72ee99217f3b1d250ac/media/libcubeb/src/cubeb_opensl.c#219-227
Comment 9•7 years ago
|
||
The problem with non working log is that it does not render any frame. It's the first callback that returns 0 frames and goes to drain (which fails to do). It does not make sense that the callback return 0 frame from the first iteration. If you see the working case log, callback is called several times returning 240 frames before it goes to drain. Do you have any clue why 0 frames are returned in the first callback?
Flags: needinfo?(achronop)
Assignee | ||
Comment 10•7 years ago
|
||
Now I saw is that the |mTimeStretcher| doesn't get any data even we have already called |mTimeStretcher::putSamples()|, the |mTimeStretcher->numSamples()| would always be ZERO [1].
Actually, I've seen that we indeed put something into FIFOSampleBuffer, I'm guessing whether we put the data into the wrong buffer or something else...
Now I'm looking into the implementation in soundtouch, but if you have any idea about this symptom, please feel free to leave any comment.
Thanks!
[1] https://goo.gl/wpQ85R
Flags: needinfo?(achronop)
Comment 11•7 years ago
|
||
The input/output of TimeStretcher is not a linear function. E.g. you might need to feed 2000 samples before you can get 500 output samples. That's why we have a while loop to keep feeding data until we have enough output samples.
Assignee | ||
Comment 12•7 years ago
|
||
(In reply to JW Wang [:jwwang] [:jw_wang] from comment #11)
> The input/output of TimeStretcher is not a linear function. E.g. you might
> need to feed 2000 samples before you can get 500 output samples. That's why
> we have a while loop to keep feeding data until we have enough output
> samples.
In this case, we can't get any output samples and would leave the loop when we get the chunk without containing any frame [1].
Any idea?
[1] https://goo.gl/DCPrZv
Flags: needinfo?(achronop) → needinfo?(jwwang)
Comment 13•7 years ago
|
||
If there is no data in the audio queue, it will just return an empty chunk.
http://searchfox.org/mozilla-central/rev/5bb6dfcb3355a912c20383578bc435c1d4ecf575/dom/media/mediasink/AudioSink.cpp#262-265
Flags: needinfo?(jwwang)
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → alwu
Assignee | ||
Comment 14•7 years ago
|
||
I was busy on the bug1274919 last week, I'll back to this bug soon.
Assignee | ||
Comment 15•7 years ago
|
||
Because people.org has been closed, the new testing URL is https://goo.gl/tXqMmf.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 17•7 years ago
|
||
Assignee | ||
Comment 18•7 years ago
|
||
Comment 19•7 years ago
|
||
Please note you have to deliver the patch on cubeb repo: https://github.com/kinetiknz/cubeb
Assignee | ||
Comment 20•7 years ago
|
||
(In reply to Alex Chronopoulos [:achronop] from comment #19)
> Please note you have to deliver the patch on cubeb repo:
> https://github.com/kinetiknz/cubeb
Thanks! I've created the pull-request in cubeb repo [1].
[1] https://github.com/kinetiknz/cubeb/pull/339
Assignee | ||
Comment 21•7 years ago
|
||
Close this bug as fixed because the changed has been merged into cubeb repo [1].
[1] https://github.com/kinetiknz/cubeb/pull/339
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 22•7 years ago
|
||
Hi, Alex,
How often we update our code from git cubeb repo?
Just want to know when my changing would be applied on m-c, because I would like to see how many test cases failure can be fixed by this changing.
Thanks!
Flags: needinfo?(achronop)
Comment 23•7 years ago
|
||
I am in the middle of another cubeb import in Bug 1380233. As soon as this one is landed I will start the new one.
Flags: needinfo?(achronop)
Assignee | ||
Comment 24•7 years ago
|
||
(In reply to Alex Chronopoulos [:achronop] from comment #23)
> I am in the middle of another cubeb import in Bug 1380233. As soon as this
> one is landed I will start the new one.
Thank you!
Assignee | ||
Comment 25•7 years ago
|
||
Sorry for another NI,
Could you add me to cc list when next time you file bug for updating the cubeb?
Thanks!
Flags: needinfo?(achronop)
Assignee | ||
Comment 26•7 years ago
|
||
Leave this bug open until the change is merged into m-c.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 28•7 years ago
|
||
Code merged in bug1381015.
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•