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)

Other Branch
defect

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.
Hi, Paul, Could you help me take a look about this issue? Thanks!
Flags: needinfo?(padenot)
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)
JW should know about this. Any idea?
Flags: needinfo?(jwwang)
Rank: 15
Priority: -- → P1
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)
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)
Attached file Log with Cubeb_OpenSL
Here is the log. It seems that the cubeb doesn't finish draining?
Flags: needinfo?(alwu)
This is the case that the media can end successfully. In this case, we don't change its playback rate (rate=1).
(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
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)
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)
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 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)
Flags: needinfo?(jwwang)
Assignee: nobody → alwu
I was busy on the bug1274919 last week, I'll back to this bug soon.
Because people.org has been closed, the new testing URL is https://goo.gl/tXqMmf.
Please note you have to deliver the patch on cubeb repo: https://github.com/kinetiknz/cubeb
(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
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
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)
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)
(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!
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)
Leave this bug open until the change is merged into m-c.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1381015
Bug 1381015, I added you in the list.
Flags: needinfo?(achronop)
Code merged in bug1381015.
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
Blocks: 1375389
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: