If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

The playing music should be reset /NOT paused after disconnectting Bluetooth

UNCONFIRMED
Unassigned

Status

()

Core
Audio/Video: Playback
UNCONFIRMED
3 years ago
2 years ago

People

(Reporter: Seil Park, Unassigned)

Tracking

unspecified
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(tracking-b2g:backlog)

Details

(Whiteboard: [ LibGLA, dev , A ][perf-reviewed])

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0 (Beta/Release)
Build ID: 20140506152807

Steps to reproduce:

The Offload player use HW codec in DSP chips.
The condition for playing offload is MP3/AAC files and longer than 1min

1. playing aac/mp3 files (use offload mode)
2. After BT connect , Music is reset a track and is restarted (change normal mode)
3. BT is disconnected and then the music is just paused. (no change offload mode)


Actual results:

For using A2DP , Music is changed from offload to normal mode. In offload mode, HW codec dosen`t have audio path from DSP to A2DP because PCM data only use audioflinger`s direct ouput. 

If the music is just paused. OMX don`t know how to pause and change offload mode.


Expected results:

If BT is disconnectted , I think it is right the gaia music should call the stop command , and then OMX can flush audio data by stop command.
(Reporter)

Updated

3 years ago
blocking-b2g: --- → 1.4?
UX,

Please weigh in for correct behavior.

Eric,

Please weigh in for technical impact here.
Flags: needinfo?(firefoxos-ux-bugzilla)
Flags: needinfo?(echou)

Comment 2

3 years ago
Flagging Tif here. Tif, please flag someone else (like Jacqueline) if you can't take this. I'm trying to leave Jacqueline focused on home and lockscreen for 2.0 just now. :)
Flags: needinfo?(firefoxos-ux-bugzilla) → needinfo?(tshakespeare)

Comment 3

3 years ago
Moving this to Audio/Video (not a music app bug) and it looks like the ask is to reset/stop music which is a request to change behavior
Component: Gaia::Music → Video/Audio
Product: Firefox OS → Core
Let me summarize to ensure I understand the situation correctly.

When playing music, if the user unplugs their headphones, the music playback pauses.

The question is, when using a Bluetooth headset, if the headset gets disconnected, should the music playback pause?

I think the answer should be yes, the playback pauses. We should not only have consistent behaviour between both cordless and corded earphones, but also want to minimize the disruption to others by having the music suddenly playing through the speakers if bluetooth drops or is disconnected.

Please let me know if I have misunderstood what you are asking. Thanks!
Flags: needinfo?(tshakespeare)
(Reporter)

Comment 5

3 years ago
The offload`s condition is for mp3/aac MUSIC.

In Android AudioTrack, the pause means that thread is waiting for the resume. the stop means that track is removed for flushing auido buffer. 

bluetooth A2DP should only use non-offload mode, whenever music play, be ready to change offload - non offload mode.

In addition, if Gaia music is stopped, need to check buffer position for resume. 

If Android music click pause button, After 3sec, automatically call the stop, save the position. 
So, music can resume the current position. 

We want to know it is possible to call the stop without initializing the position.
Is this a new feature request or an enhancement to a feature?
(Reporter)

Comment 7

3 years ago
(In reply to Preeti Raghunath(:Preeti) from comment #6)
> Is this a new feature request or an enhancement to a feature?

Is this ... do your comment mean OFFLOAD or puase/stop scenario? 
OFFLOAD is kitkat`s new feature. kitkat needs stop scenario for supporting OFFLOAD.
(Reporter)

Updated

3 years ago
Whiteboard: [ LibGLA, dev , A ]
(Reporter)

Updated

3 years ago
OS: All → Gonk (Firefox OS)
Hardware: All → ARM
(In reply to Seil Park from comment #7)
> (In reply to Preeti Raghunath(:Preeti) from comment #6)
> > Is this a new feature request or an enhancement to a feature?
> 
> Is this ... do your comment mean OFFLOAD or puase/stop scenario? 
> OFFLOAD is kitkat`s new feature. kitkat needs stop scenario for supporting
> OFFLOAD.

Thanks for the response.

What's the user impact here?
Based on comment 7 where we are requesting new scenario to be implemented, I'd backlog this one.
blocking-b2g: 1.4? → backlog
(Reporter)

Comment 10

3 years ago
(In reply to Preeti Raghunath(:Preeti) from comment #8)
> (In reply to Seil Park from comment #7)
> > (In reply to Preeti Raghunath(:Preeti) from comment #6)
> > > Is this a new feature request or an enhancement to a feature?
> > 
> > Is this ... do your comment mean OFFLOAD or puase/stop scenario? 
> > OFFLOAD is kitkat`s new feature. kitkat needs stop scenario for supporting
> > OFFLOAD.
> 
> Thanks for the response.
> 
> What's the user impact here?

OFFLOAD can save power consumtion by pass audioflinger directly.

I checked OFFLOAD scenario to be implemented last month.
However, we have to implement more to switch offload - non offload

Fistly android native opensl dosen`t have API (re create event)
Android Audio`s callback use the below event by stagefright.
- AudioTrack.h
65                                    // Not currently used by android.media.AudioTrack.
66        EVENT_NEW_IAUDIOTRACK = 6,  // IAudioTrack was re-created, either due to re-routing and
67                                    // voluntary invalidation by mediaserver, or mediaserver crash.
- MediaPlayerService.cpp
2127    case AudioTrack::EVENT_NEW_IAUDIOTRACK :
2128        ALOGV("callbackwrapper: deliver EVENT_TEAR_DOWN");
2129        (*me->mCallback)(me,  NULL /* buffer */, 0 /* size */,
2130                me->mCallbackCookie, CB_EVENT_TEAR_DOWN);
2131        break;

Gecko omx use CB_EVENT_TEAR_DOWN too, gecko-opensl interface dosen`t have CB_EVENT_TEAR_DOWN event
- AudioOffloadPlayer.cpp
458    case AudioSink::CB_EVENT_TEAR_DOWN:
459      AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Tear down event"));
460      me->NotifyAudioTearDown();
461      break;

Secondly music should stop to tear down by disconnect BT. 

Thirdly music gaia should know current position, if music is stopped to tear down.
(Reporter)

Comment 11

3 years ago
In addition, to switch offload -> non offload, uses AudioOffloadPlayer`s callback function. non offload -> offload dosen`t have event flow for CB_EVENT_TEAR_DOWN.
(Reporter)

Updated

3 years ago
blocking-b2g: backlog → 2.0?
Mike - Can you weigh in on a blocking decision from a performance perspective?
Flags: needinfo?(mlee)
Keywords: perf, power
This issue appears to be functionality/features with perf (power) implications.  We don't think this is a blocking issue specifically for the power consumption part.
Flags: needinfo?(mlee)
Keywords: perf, power
Whiteboard: [ LibGLA, dev , A ] → [ LibGLA, dev , A ][perf-reviewed]
Partner provided these figures for under the different modes

Offload : about 27.19 mA
Non-Offload : about 63.02 mA

Updated

3 years ago
Flags: needinfo?(echou) → needinfo?(waychen)
Please help me to do this experiment:

1. playing aac/mp3 files (use offload mode)
2. After BT connect , Music is reset a track and is restarted (change normal mode)
3. BT is disconnected and music stop
4. hold 3 sec at least
5. and then push play button

does the scenario not enter offload mode?
Flags: needinfo?(waychen)
Moving this to backlog per perf comment 13
blocking-b2g: 2.0? → backlog

Comment 17

3 years ago
I have compared Android and FireFoxOS to analysis operation.

[Android]
1. Music is stopped by step3 of comment 15.
2. Audio track sends "EVENT_NEW_IAUDIOTRACK" callback for tear down event.
3. MediaPlayerService receives this callback and sends "CB_EVENT_TEAR_DOWN" callback to AudioPlayer.
4. After receives callback, AudioPlayer calls AwesomePlayer::onAudioTearDownEvent().
5. If called AwesomePlayer::onAudioTearDownEvent(), player will be called like below.
   getPosition(to seek position) -> reset -> setDataSource -> beginPrepareAsync_l -> seekTo(position).
   (Please refer AwesomePlayer::onAudioTearDownEvent() function.)
6. After onAudioTearDownEvent function, player will be played using offload mode.

[FireFox OS]
1. Music is stopped by step3 of comment 15.
2. Audio track sends "EVENT_NEW_IAUDIOTRACK" callback for tear down event.
3. Since gecko' AudioStream is using OpenSLES, this callback is sent to OpenSLES.
4. But because OpenSLES does not be implemented event case for "EVENT_NEW_IAUDIOTRACK",
   OpenSLES can not receive "EVENT_NEW_IAUDIOTRACK" event.
   (Please refer audioTrack_callBack_pullFromBuffQueue function in AudioPlayer_to_android.cpp)

In my opinion, to use offload mode after BT disconnect,FireFox OS will be need to implement like below.
1. To receive "EVENT_NEW_IAUDIOTRACK" event from AudioTrack, OpenSLES or AudioStream will be modified.
2. After receives "EVENT_NEW_IAUDIOTRACK", gecko will be added AudioTearDown function like "AwesomePlayer::onAudioTearDownEvent()"

Thanks.
^^^^^^^
Flags: needinfo?(waychen)
Hi wchang,

as Jaemin's comment, gecko doesn't support this feature now. 

Sincerely,
Wayne
Flags: needinfo?(waychen)

Updated

3 years ago
Flags: needinfo?(wchang)
Hi,

given the above comments, we're unable to switch back to offload mode without altering the current UX and at the moment there is no plan to change the current UX.

Rob, would there be concerns if partner wants to alter the UX here on their end and make music stop instead of pause on disconnecting BT headset?
Flags: needinfo?(wchang)
Flags: needinfo?(rmacdonald)
Flags: needinfo?(oedipus31)
(Reporter)

Comment 21

3 years ago
(In reply to Wayne Chang [:wchang] from comment #20)
> Hi,
> 
> given the above comments, we're unable to switch back to offload mode
> without altering the current UX and at the moment there is no plan to change
> the current UX.
> 
> Rob, would there be concerns if partner wants to alter the UX here on their
> end and make music stop instead of pause on disconnecting BT headset?

We understand the reason for not switching back to offload mode. we wish teardown event supporting (comment 15) in the next version. Currently, ffos just need tear down flow for bt disconnect, but android need for audio effect / normalize / bt a2dp.
(Reporter)

Updated

3 years ago
Flags: needinfo?(oedipus31)
Flagging Jacqueline as the UX lead for Music. Apologies for the delay.
Flags: needinfo?(rmacdonald) → needinfo?(jsavory)
I'm sorry, but I'm not sure that I clearly understand the question that is being asked. 
Are you saying we can only stop the music rather than pause when a bluetooth headset is disconnected and we need UX for this situation?
Flags: needinfo?(jsavory)
(Assignee)

Updated

3 years ago
blocking-b2g: backlog → ---
tracking-b2g: --- → backlog
Component: Audio/Video → Audio/Video: Playback
You need to log in before you can comment on or make changes to this bug.