Bug 809558 - Turn on audiochannels for Android AudioTrack. r=kinetic

This commit is contained in:
Wes Johnston 2013-04-11 15:37:35 -07:00
parent 7e22f12b51
commit b1f0a674a3
2 changed files with 10 additions and 10 deletions

View File

@ -2158,7 +2158,7 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
bool HTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString) bool HTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString)
{ {
#ifdef MOZ_B2G #ifdef ANDROID
// Only normal channel doesn't need permission. // Only normal channel doesn't need permission.
if (!aString.EqualsASCII("normal")) { if (!aString.EqualsASCII("normal")) {
nsCOMPtr<nsIPermissionManager> permissionManager = nsCOMPtr<nsIPermissionManager> permissionManager =
@ -3213,7 +3213,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
{ {
nsIDocument* ownerDoc = OwnerDoc(); nsIDocument* ownerDoc = OwnerDoc();
#ifdef MOZ_B2G #ifdef ANDROID
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(OwnerDoc()); nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(OwnerDoc());
if (domDoc) { if (domDoc) {
bool hidden = false; bool hidden = false;
@ -3653,7 +3653,7 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(bool aCanPlay)
{ {
// Only on B2G we mute the HTMLMediaElement following the rules of // Only on B2G we mute the HTMLMediaElement following the rules of
// AudioChannelService. // AudioChannelService.
#ifdef MOZ_B2G #ifdef ANDROID
// We have to mute this channel: // We have to mute this channel:
if (!aCanPlay && !mChannelSuspended) { if (!aCanPlay && !mChannelSuspended) {
mChannelSuspended = true; mChannelSuspended = true;
@ -3672,7 +3672,7 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(bool aCanPlay)
void HTMLMediaElement::UpdateAudioChannelPlayingState() void HTMLMediaElement::UpdateAudioChannelPlayingState()
{ {
// The HTMLMediaElement is registered to the AudioChannelService only on B2G. // The HTMLMediaElement is registered to the AudioChannelService only on B2G.
#ifdef MOZ_B2G #ifdef ANDROID
bool playingThroughTheAudioChannel = bool playingThroughTheAudioChannel =
(!mPaused && (!mPaused &&
(HasAttr(kNameSpaceID_None, nsGkAtoms::loop) || (HasAttr(kNameSpaceID_None, nsGkAtoms::loop) ||

View File

@ -146,17 +146,17 @@ audiotrack_get_min_frame_count(cubeb * ctx, cubeb_stream_params * params, int *
/* Recent Android have a getMinFrameCount method. On Froyo, we have to compute it by hand. */ /* Recent Android have a getMinFrameCount method. On Froyo, we have to compute it by hand. */
if (audiotrack_version_is_froyo(ctx)) { if (audiotrack_version_is_froyo(ctx)) {
int samplerate, frame_count, latency, min_buffer_count; int samplerate, frame_count, latency, min_buffer_count;
status = ctx->klass.get_output_frame_count(&frame_count, AUDIO_STREAM_TYPE_MUSIC); status = ctx->klass.get_output_frame_count(&frame_count, params->stream_type);
if (status) { if (status) {
ALOG("error getting the output frame count."); ALOG("error getting the output frame count.");
return CUBEB_ERROR; return CUBEB_ERROR;
} }
status = ctx->klass.get_output_latency((uint32_t*)&latency, AUDIO_STREAM_TYPE_MUSIC); status = ctx->klass.get_output_latency((uint32_t*)&latency, params->stream_type);
if (status) { if (status) {
ALOG("error getting the output frame count."); ALOG("error getting the output frame count.");
return CUBEB_ERROR; return CUBEB_ERROR;
} }
status = ctx->klass.get_output_samplingrate(&samplerate, AUDIO_STREAM_TYPE_MUSIC); status = ctx->klass.get_output_samplingrate(&samplerate, params->stream_type);
if (status) { if (status) {
ALOG("error getting the output frame count."); ALOG("error getting the output frame count.");
return CUBEB_ERROR; return CUBEB_ERROR;
@ -173,7 +173,7 @@ audiotrack_get_min_frame_count(cubeb * ctx, cubeb_stream_params * params, int *
return CUBEB_OK; return CUBEB_OK;
} }
/* Recent Android have a getMinFrameCount method. */ /* Recent Android have a getMinFrameCount method. */
status = ctx->klass.get_min_frame_count(min_frame_count, AUDIO_STREAM_TYPE_MUSIC, params->rate); status = ctx->klass.get_min_frame_count(min_frame_count, params->stream_type, params->rate);
if (status != 0) { if (status != 0) {
ALOG("error getting the min frame count"); ALOG("error getting the min frame count");
return CUBEB_ERROR; return CUBEB_ERROR;
@ -308,7 +308,7 @@ audiotrack_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_
if (audiotrack_version_is_froyo(ctx)) { if (audiotrack_version_is_froyo(ctx)) {
ctx->klass.ctor_froyo(stm->instance, ctx->klass.ctor_froyo(stm->instance,
AUDIO_STREAM_TYPE_MUSIC, stm->params.stream_type,
stm->params.rate, stm->params.rate,
AUDIO_FORMAT_PCM_16_BIT, AUDIO_FORMAT_PCM_16_BIT,
channels, channels,
@ -319,7 +319,7 @@ audiotrack_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_
0); 0);
} else { } else {
ctx->klass.ctor(stm->instance, ctx->klass.ctor(stm->instance,
AUDIO_STREAM_TYPE_MUSIC, stm->params.stream_type,
stm->params.rate, stm->params.rate,
AUDIO_FORMAT_PCM_16_BIT, AUDIO_FORMAT_PCM_16_BIT,
channels, channels,