From dd65afd5437dd7d139e1479c75e6f28252d120dc Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Thu, 11 Apr 2013 15:37:35 -0700 Subject: [PATCH] Bug 809558 - Turn on audiochannels for Android AudioTrack. r=kinetic --- content/html/content/src/HTMLMediaElement.cpp | 8 ++++---- media/libcubeb/src/cubeb_audiotrack.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/content/html/content/src/HTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp index 2c33af0fb72..2cca0a19732 100644 --- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -2158,7 +2158,7 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID, bool HTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString) { -#ifdef MOZ_B2G +#ifdef ANDROID // Only normal channel doesn't need permission. if (!aString.EqualsASCII("normal")) { nsCOMPtr permissionManager = @@ -3213,7 +3213,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() { nsIDocument* ownerDoc = OwnerDoc(); -#ifdef MOZ_B2G +#ifdef ANDROID nsCOMPtr domDoc = do_QueryInterface(OwnerDoc()); if (domDoc) { bool hidden = false; @@ -3653,7 +3653,7 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(bool aCanPlay) { // Only on B2G we mute the HTMLMediaElement following the rules of // AudioChannelService. -#ifdef MOZ_B2G +#ifdef ANDROID // We have to mute this channel: if (!aCanPlay && !mChannelSuspended) { mChannelSuspended = true; @@ -3672,7 +3672,7 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(bool aCanPlay) void HTMLMediaElement::UpdateAudioChannelPlayingState() { // The HTMLMediaElement is registered to the AudioChannelService only on B2G. -#ifdef MOZ_B2G +#ifdef ANDROID bool playingThroughTheAudioChannel = (!mPaused && (HasAttr(kNameSpaceID_None, nsGkAtoms::loop) || diff --git a/media/libcubeb/src/cubeb_audiotrack.c b/media/libcubeb/src/cubeb_audiotrack.c index 723dc947e37..f5e6efcaa5c 100644 --- a/media/libcubeb/src/cubeb_audiotrack.c +++ b/media/libcubeb/src/cubeb_audiotrack.c @@ -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. */ if (audiotrack_version_is_froyo(ctx)) { 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) { ALOG("error getting the output frame count."); 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) { ALOG("error getting the output frame count."); 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) { ALOG("error getting the output frame count."); return CUBEB_ERROR; @@ -173,7 +173,7 @@ audiotrack_get_min_frame_count(cubeb * ctx, cubeb_stream_params * params, int * return CUBEB_OK; } /* 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) { ALOG("error getting the min frame count"); return CUBEB_ERROR; @@ -308,7 +308,7 @@ audiotrack_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_ if (audiotrack_version_is_froyo(ctx)) { ctx->klass.ctor_froyo(stm->instance, - AUDIO_STREAM_TYPE_MUSIC, + stm->params.stream_type, stm->params.rate, AUDIO_FORMAT_PCM_16_BIT, channels, @@ -319,7 +319,7 @@ audiotrack_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_ 0); } else { ctx->klass.ctor(stm->instance, - AUDIO_STREAM_TYPE_MUSIC, + stm->params.stream_type, stm->params.rate, AUDIO_FORMAT_PCM_16_BIT, channels,