Loading media/libstagefright/AwesomePlayer.cpp +26 −27 Original line number Diff line number Diff line Loading @@ -1150,9 +1150,20 @@ status_t AwesomePlayer::fallbackToSWDecoder() { mAudioSource.clear(); modifyFlags((AUDIO_RUNNING | AUDIOPLAYER_STARTED), CLEAR); mOffloadAudio = false; const char * mime; sp<MetaData> tempMetadata; sp<MetaData> format = mAudioTrack->getFormat(); CHECK(format->findCString(kKeyMIMEType, &mime)); if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW)) { mAudioSource = mAudioTrack; tempMetadata = ExtendedUtils::updatePCMFormatAndBitwidth(mAudioTrack, mOffloadAudio); } else { mAudioSource = mOmxSource; } if (mAudioSource != NULL) { if ((err = mAudioSource->start()) == OK) { if ((err = mAudioSource->start(tempMetadata.get())) == OK) { mSeekNotificationSent = true; if (mExtractorFlags & MediaExtractor::CAN_SEEK) { seekTo_l(curTimeUs); Loading @@ -1164,6 +1175,7 @@ status_t AwesomePlayer::fallbackToSWDecoder() { mOmxSource.clear(); } } tempMetadata.clear(); return err; } Loading Loading @@ -1743,26 +1755,13 @@ status_t AwesomePlayer::initAudioDecoder() { } } #if defined(ENABLE_AV_ENHANCEMENTS) && defined(PCM_OFFLOAD_ENABLED_24) sp<MetaData> tempMetadata; if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW)) { ALOGV("%s MEDIA_MIMETYPE_AUDIO_RAW", __func__); tempMetadata = new MetaData; sp<MetaData> format = mAudioSource->getFormat(); int bitWidth = 16; format->findInt32(kKeySampleBits, &bitWidth); char prop_pcmoffload[PROPERTY_VALUE_MAX] = {0}; property_get("audio.offload.pcm.enable", prop_pcmoffload, "0"); if ((mOffloadAudio) && (24 == bitWidth) && (!strcmp(prop_pcmoffload, "true") || atoi(prop_pcmoffload))) tempMetadata->setInt32(kKeyPcmFormat, AUDIO_FORMAT_PCM_8_24_BIT); tempMetadata = ExtendedUtils::updatePCMFormatAndBitwidth(mAudioSource, mOffloadAudio); } err = mAudioSource->start(tempMetadata.get()); tempMetadata.clear(); #else err = mAudioSource->start(); #endif if (err != OK) { mAudioSource.clear(); Loading media/libstagefright/ExtendedUtils.cpp +28 −0 Original line number Diff line number Diff line Loading @@ -878,6 +878,27 @@ void ExtendedUtils::setBFrames( return; } sp<MetaData> ExtendedUtils::updatePCMFormatAndBitwidth( sp<MediaSource> &audioSource, bool offloadAudio) { sp<MetaData> tempMetadata = new MetaData; sp<MetaData> format = audioSource->getFormat(); int bitWidth = 16; #ifdef PCM_OFFLOAD_ENABLED_24 format->findInt32(kKeySampleBits, &bitWidth); tempMetadata->setInt32(kKeySampleBits, bitWidth); tempMetadata->setInt32(kKeyPcmFormat, AUDIO_FORMAT_PCM_16_BIT); char prop_pcmoffload[PROPERTY_VALUE_MAX] = {0}; property_get("audio.offload.pcm.enable", prop_pcmoffload, "0"); if ((offloadAudio) && (24 == bitWidth) && (!strcmp(prop_pcmoffload, "true") || atoi(prop_pcmoffload))) { tempMetadata->setInt32(kKeyPcmFormat, AUDIO_FORMAT_PCM_8_24_BIT); } #endif return tempMetadata; } /* QCOM HW AAC encoder allowed bitrates ------------------------------------------------------------------------------------------------------------------ Loading Loading @@ -1630,6 +1651,13 @@ void ExtendedUtils::RTSPStream::addSDES(int s, const sp<ABuffer> &buffer) { namespace android { sp<MetaData> ExtendedUtils::updatePCMFormatAndBitwidth( sp<MediaSource> &audioSource, bool offloadAudio) { sp<MetaData> tempMetadata = new MetaData; return tempMetadata; } void ExtendedUtils::HFR::setHFRIfEnabled( const CameraParameters& params, sp<MetaData> &meta) { ARG_TOUCH(params); Loading media/libstagefright/include/ExtendedUtils.h +2 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,8 @@ struct ExtendedUtils { static bool isVideoMuxFormatSupported(const char *mime); static void printFileName(int fd); static sp<MetaData> updatePCMFormatAndBitwidth(sp<MediaSource> &audioSource, bool offloadAudio); static void applyPreRotation( const CameraParameters& params, sp<MetaData> &meta); Loading Loading
media/libstagefright/AwesomePlayer.cpp +26 −27 Original line number Diff line number Diff line Loading @@ -1150,9 +1150,20 @@ status_t AwesomePlayer::fallbackToSWDecoder() { mAudioSource.clear(); modifyFlags((AUDIO_RUNNING | AUDIOPLAYER_STARTED), CLEAR); mOffloadAudio = false; const char * mime; sp<MetaData> tempMetadata; sp<MetaData> format = mAudioTrack->getFormat(); CHECK(format->findCString(kKeyMIMEType, &mime)); if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW)) { mAudioSource = mAudioTrack; tempMetadata = ExtendedUtils::updatePCMFormatAndBitwidth(mAudioTrack, mOffloadAudio); } else { mAudioSource = mOmxSource; } if (mAudioSource != NULL) { if ((err = mAudioSource->start()) == OK) { if ((err = mAudioSource->start(tempMetadata.get())) == OK) { mSeekNotificationSent = true; if (mExtractorFlags & MediaExtractor::CAN_SEEK) { seekTo_l(curTimeUs); Loading @@ -1164,6 +1175,7 @@ status_t AwesomePlayer::fallbackToSWDecoder() { mOmxSource.clear(); } } tempMetadata.clear(); return err; } Loading Loading @@ -1743,26 +1755,13 @@ status_t AwesomePlayer::initAudioDecoder() { } } #if defined(ENABLE_AV_ENHANCEMENTS) && defined(PCM_OFFLOAD_ENABLED_24) sp<MetaData> tempMetadata; if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW)) { ALOGV("%s MEDIA_MIMETYPE_AUDIO_RAW", __func__); tempMetadata = new MetaData; sp<MetaData> format = mAudioSource->getFormat(); int bitWidth = 16; format->findInt32(kKeySampleBits, &bitWidth); char prop_pcmoffload[PROPERTY_VALUE_MAX] = {0}; property_get("audio.offload.pcm.enable", prop_pcmoffload, "0"); if ((mOffloadAudio) && (24 == bitWidth) && (!strcmp(prop_pcmoffload, "true") || atoi(prop_pcmoffload))) tempMetadata->setInt32(kKeyPcmFormat, AUDIO_FORMAT_PCM_8_24_BIT); tempMetadata = ExtendedUtils::updatePCMFormatAndBitwidth(mAudioSource, mOffloadAudio); } err = mAudioSource->start(tempMetadata.get()); tempMetadata.clear(); #else err = mAudioSource->start(); #endif if (err != OK) { mAudioSource.clear(); Loading
media/libstagefright/ExtendedUtils.cpp +28 −0 Original line number Diff line number Diff line Loading @@ -878,6 +878,27 @@ void ExtendedUtils::setBFrames( return; } sp<MetaData> ExtendedUtils::updatePCMFormatAndBitwidth( sp<MediaSource> &audioSource, bool offloadAudio) { sp<MetaData> tempMetadata = new MetaData; sp<MetaData> format = audioSource->getFormat(); int bitWidth = 16; #ifdef PCM_OFFLOAD_ENABLED_24 format->findInt32(kKeySampleBits, &bitWidth); tempMetadata->setInt32(kKeySampleBits, bitWidth); tempMetadata->setInt32(kKeyPcmFormat, AUDIO_FORMAT_PCM_16_BIT); char prop_pcmoffload[PROPERTY_VALUE_MAX] = {0}; property_get("audio.offload.pcm.enable", prop_pcmoffload, "0"); if ((offloadAudio) && (24 == bitWidth) && (!strcmp(prop_pcmoffload, "true") || atoi(prop_pcmoffload))) { tempMetadata->setInt32(kKeyPcmFormat, AUDIO_FORMAT_PCM_8_24_BIT); } #endif return tempMetadata; } /* QCOM HW AAC encoder allowed bitrates ------------------------------------------------------------------------------------------------------------------ Loading Loading @@ -1630,6 +1651,13 @@ void ExtendedUtils::RTSPStream::addSDES(int s, const sp<ABuffer> &buffer) { namespace android { sp<MetaData> ExtendedUtils::updatePCMFormatAndBitwidth( sp<MediaSource> &audioSource, bool offloadAudio) { sp<MetaData> tempMetadata = new MetaData; return tempMetadata; } void ExtendedUtils::HFR::setHFRIfEnabled( const CameraParameters& params, sp<MetaData> &meta) { ARG_TOUCH(params); Loading
media/libstagefright/include/ExtendedUtils.h +2 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,8 @@ struct ExtendedUtils { static bool isVideoMuxFormatSupported(const char *mime); static void printFileName(int fd); static sp<MetaData> updatePCMFormatAndBitwidth(sp<MediaSource> &audioSource, bool offloadAudio); static void applyPreRotation( const CameraParameters& params, sp<MetaData> &meta); Loading