summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/media/ToneGenerator.h2
-rw-r--r--media/libavextensions/stagefright/AVUtils.cpp6
-rw-r--r--media/libmedia/ICrypto.cpp4
-rw-r--r--media/libmedia/ToneGenerator.cpp6
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp17
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp7
-rw-r--r--media/libstagefright/ACodec.cpp22
-rw-r--r--media/libstagefright/CameraSource.cpp12
-rw-r--r--media/libstagefright/MediaCodec.cpp2
-rw-r--r--media/libstagefright/StagefrightMetadataRetriever.cpp3
-rw-r--r--media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp9
-rw-r--r--media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp9
-rw-r--r--services/audioflinger/Android.mk25
-rw-r--r--services/audioflinger/AudioFlinger.cpp40
-rw-r--r--services/audioflinger/AudioMixer.cpp14
-rw-r--r--services/audioflinger/Effects.cpp6
-rw-r--r--services/audioflinger/Threads.cpp66
-rw-r--r--services/audioflinger/Threads.h20
18 files changed, 230 insertions, 40 deletions
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index 8406ed6..0043bdc 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -148,6 +148,8 @@ public:
TONE_CDMA_ABBR_ALERT,
TONE_CDMA_SIGNAL_OFF,
//CDMA end
+ TONE_HOLD_RECALL,
+
NUM_TONES,
NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1
};
diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp
index bdf5eb6..413026b 100644
--- a/media/libavextensions/stagefright/AVUtils.cpp
+++ b/media/libavextensions/stagefright/AVUtils.cpp
@@ -448,7 +448,7 @@ status_t AVUtils::HEVCMuxer::makeHEVCCodecSpecificData(
List<HEVCParamSet> picParamSets;
if ((*codecSpecificDataSize = parseHEVCCodecSpecificData(data, size,
- vidParamSets, seqParamSets, picParamSets)) <= 0) {
+ vidParamSets, seqParamSets, picParamSets)) == 0) {
ALOGE("cannot parser codec specific data, bailing out");
return ERROR_MALFORMED;
}
@@ -885,12 +885,12 @@ size_t AVUtils::HEVCMuxer::parseHEVCCodecSpecificData(
}
} else {
ALOGE("Only VPS, SPS and PPS Nal units are expected");
- return ERROR_MALFORMED;
+ return 0;
}
if (nextStartCode == NULL) {
ALOGE("Next start code is NULL");
- return ERROR_MALFORMED;
+ return 0;
}
// Move on to find the next parameter set
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index 5d822cf..bc696ca 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -325,7 +325,9 @@ status_t BnCrypto::onTransact(
if (overflow || sumSubsampleSizes != totalSize) {
result = -EINVAL;
- } else if (offset + totalSize > sharedBuffer->size()) {
+ } else if (totalSize > sharedBuffer->size()) {
+ result = -EINVAL;
+ } else if ((size_t)offset > sharedBuffer->size() - totalSize) {
result = -EINVAL;
} else {
result = decrypt(
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index d738ea7..af75e0f 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -698,7 +698,11 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = {
{ .segments = { { .duration = 0, .waveFreq = { 0 }, 0, 0 }},
.repeatCnt = 0,
.repeatSegment = 0 }, // TONE_CDMA_SIGNAL_OFF
-
+ { .segments = { { .duration = 15000, .waveFreq = { 0 }, 0, 0 },
+ { .duration = 500, .waveFreq = { 450, 0 }, 0, 0 },
+ { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
+ .repeatCnt = ToneGenerator::TONEGEN_INF,
+ .repeatSegment = 0 }, // TONE_HOLD_RECALL
{ .segments = { { .duration = ToneGenerator::TONEGEN_INF, .waveFreq = { 350, 440, 0 }, 0, 0 },
{ .duration = 0 , .waveFreq = { 0 }, 0, 0}},
.repeatCnt = ToneGenerator::TONEGEN_INF,
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 7c71e4e..4383fce 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -750,12 +750,19 @@ void NuPlayerDriver::notifyListener_l(
}
}
if (mLooping || mAutoLoop) {
- mPlayer->seekToAsync(0);
- if (mAudioSink != NULL) {
- // The renderer has stopped the sink at the end in order to play out
- // the last little bit of audio. If we're looping, we need to restart it.
- mAudioSink->start();
+ if (mState == STATE_RUNNING) {
+ mPlayer->seekToAsync(0);
+ if (mAudioSink != NULL) {
+ // The renderer has stopped the sink at the end in order to play out
+ // the last little bit of audio. If we're looping, we need to restart it.
+ mAudioSink->start();
+ }
+ } else {
+ mPlayer->pause();
+ mState = STATE_PAUSED;
+ mAtEOS = true;
}
+
// don't send completion event when looping
return;
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index d959e62..2336eb7 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -1590,6 +1590,13 @@ void NuPlayer::Renderer::onResume() {
ALOGD("received error :%d on resume for offload track posting TEAR_DOWN event",status);
notifyAudioTearDown();
}
+ //Update anchor time after resuming playback.
+ if (offloadingAudio()) {
+ int64_t nowUs = ALooper::GetNowUs();
+ int64_t nowMediaUs =
+ mAudioFirstAnchorTimeMediaUs + getPlayedOutAudioDurationUs(nowUs);
+ mMediaClock->updateAnchor(nowMediaUs, nowUs, INT64_MAX);
+ }
}
{
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index ad4676f..4807b65 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -925,7 +925,7 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(
#endif
ALOGV("gralloc usage: %#x(OMX) => %#x(ACodec)", omxUsage, usage);
- return setNativeWindowSizeFormatAndUsage(
+ err = setNativeWindowSizeFormatAndUsage(
nativeWindow,
def.format.video.nFrameWidth,
def.format.video.nFrameHeight,
@@ -936,6 +936,26 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(
#endif
mRotationDegrees,
usage);
+#ifdef QCOM_HARDWARE
+ if (err == OK) {
+ OMX_CONFIG_RECTTYPE rect;
+ InitOMXParams(&rect);
+ rect.nPortIndex = kPortIndexOutput;
+ err = mOMX->getConfig(
+ mNode, OMX_IndexConfigCommonOutputCrop, &rect, sizeof(rect));
+ if (err == OK) {
+ ALOGV("rect size = %d, %d, %d, %d", rect.nLeft, rect.nTop, rect.nWidth, rect.nHeight);
+ android_native_rect_t crop;
+ crop.left = rect.nLeft;
+ crop.top = rect.nTop;
+ crop.right = rect.nLeft + rect.nWidth - 1;
+ crop.bottom = rect.nTop + rect.nHeight - 1;
+ ALOGV("crop update (%d, %d), (%d, %d)", crop.left, crop.top, crop.right, crop.bottom);
+ err = native_window_set_crop(nativeWindow, &crop);
+ }
+ }
+#endif
+ return err;
}
status_t ACodec::configureOutputBuffersFromNativeWindow(
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 4ee878a..e2ad924 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -325,12 +325,6 @@ status_t CameraSource::isCameraColorFormatSupported(
return OK;
}
-static int32_t getHighSpeedFrameRate(const CameraParameters& params) {
- const char* hsr = params.get("video-hsr");
- int32_t rate = (hsr != NULL && strncmp(hsr, "off", 3)) ? atoi(hsr) : 0;
- return rate > 240 ? 240 : rate;
-}
-
/*
* Configure the camera to use the requested video size
* (width and height) and/or frame rate. If both width and
@@ -383,10 +377,6 @@ status_t CameraSource::configureCamera(
params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);
CHECK(supportedFrameRates != NULL);
ALOGV("Supported frame rates: %s", supportedFrameRates);
- if (getHighSpeedFrameRate(*params)) {
- ALOGI("Use default 30fps for HighSpeed %dfps", frameRate);
- frameRate = 30;
- }
char buf[4];
snprintf(buf, 4, "%d", frameRate);
if (strstr(supportedFrameRates, buf) == NULL) {
@@ -488,8 +478,6 @@ status_t CameraSource::checkFrameRate(
ALOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);
return UNKNOWN_ERROR;
}
- int32_t highSpeedRate = getHighSpeedFrameRate(params);
- frameRateActual = highSpeedRate ? highSpeedRate : frameRateActual;
// Check the actual video frame rate against the target/requested
// video frame rate.
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 54c57ee..5e0ee55 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -2575,7 +2575,7 @@ ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) {
info->mOwnedByClient = true;
// set image-data
- if (info->mFormat != NULL) {
+ if (info->mFormat != NULL && mIsVideo) {
sp<ABuffer> imageData;
if (info->mFormat->findBuffer("image-data", &imageData)) {
info->mData->meta()->setBuffer("image-data", imageData);
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 5b96040..d39f34b 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -273,6 +273,9 @@ static VideoFrame *extractVideoFrame(
if (err != OK) {
ALOGW("Input Error or EOS");
haveMoreInputs = false;
+ //correct the status to continue to get output from decoder
+ err = OK;
+ inputIndex = -1;
break;
}
diff --git a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp
index 8240f83..f2a4e65 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp
@@ -37,6 +37,10 @@
#include <inttypes.h>
+#ifndef INT32_MAX
+#define INT32_MAX 2147483647
+#endif
+
namespace android {
template<class T>
@@ -137,6 +141,11 @@ OMX_ERRORTYPE SoftMPEG4Encoder::initEncParams() {
if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) {
// Color conversion is needed.
free(mInputFrameData);
+ mInputFrameData = NULL;
+ if (((uint64_t)mWidth * mHeight) > ((uint64_t)INT32_MAX / 3)) {
+ ALOGE("b/25812794, Buffer size is too big.");
+ return OMX_ErrorBadParameter;
+ }
mInputFrameData =
(uint8_t *) malloc((mWidth * mHeight * 3 ) >> 1);
CHECK(mInputFrameData != NULL);
diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp
index e654843..410f9d0 100644
--- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp
+++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp
@@ -26,6 +26,10 @@
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/MediaDefs.h>
+#ifndef INT32_MAX
+#define INT32_MAX 2147483647
+#endif
+
namespace android {
template<class T>
@@ -315,6 +319,11 @@ status_t SoftVPXEncoder::initEncoder() {
if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) {
free(mConversionBuffer);
+ mConversionBuffer = NULL;
+ if (((uint64_t)mWidth * mHeight) > ((uint64_t)INT32_MAX / 3)) {
+ ALOGE("b/25812794, Buffer size is too big.");
+ return UNKNOWN_ERROR;
+ }
mConversionBuffer = (uint8_t *)malloc(mWidth * mHeight * 3 / 2);
if (mConversionBuffer == NULL) {
ALOGE("Allocating conversion buffer failed.");
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 474fb46..0dd2af6 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -1,3 +1,23 @@
+#
+# This file was modified by DTS, Inc. The portions of the
+# code that are surrounded by "DTS..." are copyrighted and
+# licensed separately, as follows:
+#
+# (C) 2015 DTS, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -86,6 +106,11 @@ LOCAL_SRC_FILES += \
LOCAL_CFLAGS += -DSTATE_QUEUE_INSTANTIATIONS='"StateQueueInstantiations.cpp"'
LOCAL_CFLAGS += -fvisibility=hidden
+ifeq ($(strip $(BOARD_USES_SRS_TRUEMEDIA)),true)
+LOCAL_SHARED_LIBRARIES += libsrsprocessing
+LOCAL_CFLAGS += -DSRS_PROCESSING
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-effects
+endif
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 1acfaad..23215dd 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -13,6 +13,25 @@
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
+**
+** This file was modified by DTS, Inc. The portions of the
+** code that are surrounded by "DTS..." are copyrighted and
+** licensed separately, as follows:
+**
+** (C) 2015 DTS, Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+**
*/
@@ -64,6 +83,9 @@
#include <media/nbaio/PipeReader.h>
#include <media/AudioParameter.h>
#include <private/android_filesystem_config.h>
+#ifdef SRS_PROCESSING
+#include "postpro_patch.h"
+#endif
// ----------------------------------------------------------------------------
@@ -1051,6 +1073,13 @@ status_t AudioFlinger::setParameters(audio_io_handle_t ioHandle, const String8&
if (ioHandle == AUDIO_IO_HANDLE_NONE) {
Mutex::Autolock _l(mLock);
status_t final_result = NO_ERROR;
+#ifdef SRS_PROCESSING
+ POSTPRO_PATCH_PARAMS_SET(keyValuePairs);
+ for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
+ PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
+ thread->setPostPro();
+ }
+#endif
{
AutoMutex lock(mHardwareLock);
mHardwareStatus = AUDIO_HW_SET_PARAMETER;
@@ -1145,6 +1174,9 @@ String8 AudioFlinger::getParameters(audio_io_handle_t ioHandle, const String8& k
if (ioHandle == AUDIO_IO_HANDLE_NONE) {
String8 out_s8;
+#ifdef SRS_PROCESSING
+ POSTPRO_PATCH_PARAMS_GET(keys, out_s8);
+#endif
for (size_t i = 0; i < mAudioHwDevs.size(); i++) {
char *s;
@@ -1370,6 +1402,12 @@ sp<AudioFlinger::PlaybackThread> AudioFlinger::getEffectThread_l(int sessionId,
+void AudioFlinger::PlaybackThread::setPostPro()
+{
+ Mutex::Autolock _l(mLock);
+ if (mType == OFFLOAD)
+ broadcast_l();
+}
// ----------------------------------------------------------------------------
AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid)
@@ -2991,7 +3029,7 @@ void AudioFlinger::dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_hand
bool firstRead = true;
#define TEE_SINK_READ 1024 // frames per I/O operation
void *buffer = malloc(TEE_SINK_READ * frameSize);
- CHECK (buffer != NULL);
+ ALOG_ASSERT(buffer != NULL);
for (;;) {
size_t count = TEE_SINK_READ;
ssize_t actual = teeSource->read(buffer, count,
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 27a2f65..806eaf1 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -308,6 +308,11 @@ bool AudioMixer::setChannelMasks(int name,
void AudioMixer::track_t::unprepareForDownmix() {
ALOGV("AudioMixer::unprepareForDownmix(%p)", this);
+ if (mPostDownmixReformatBufferProvider != NULL) {
+ delete mPostDownmixReformatBufferProvider;
+ mPostDownmixReformatBufferProvider = NULL;
+ reconfigureBufferProviders();
+ }
mDownmixRequiresFormat = AUDIO_FORMAT_INVALID;
if (downmixerBufferProvider != NULL) {
// this track had previously been configured with a downmixer, delete it
@@ -363,18 +368,9 @@ status_t AudioMixer::track_t::prepareForDownmix()
void AudioMixer::track_t::unprepareForReformat() {
ALOGV("AudioMixer::unprepareForReformat(%p)", this);
- bool requiresReconfigure = false;
if (mReformatBufferProvider != NULL) {
delete mReformatBufferProvider;
mReformatBufferProvider = NULL;
- requiresReconfigure = true;
- }
- if (mPostDownmixReformatBufferProvider != NULL) {
- delete mPostDownmixReformatBufferProvider;
- mPostDownmixReformatBufferProvider = NULL;
- requiresReconfigure = true;
- }
- if (requiresReconfigure) {
reconfigureBufferProviders();
}
}
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index fb1e80c..879b6c9 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1466,14 +1466,14 @@ void AudioFlinger::EffectChain::process_l()
}
size_t size = mEffects.size();
- for (size_t i = 0; i < size; i++) {
- mEffects[i]->updateState();
- }
if (doProcess) {
for (size_t i = 0; i < size; i++) {
mEffects[i]->process();
}
}
+ for (size_t i = 0; i < size; i++) {
+ mEffects[i]->updateState();
+ }
}
// addEffect_l() must be called with PlaybackThread::mLock held
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 8c59282..1f60924 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -13,6 +13,25 @@
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
+**
+** This file was modified by DTS, Inc. The portions of the
+** code that are surrounded by "DTS..." are copyrighted and
+** licensed separately, as follows:
+**
+** (C) 2015 DTS, Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+**
*/
@@ -72,6 +91,9 @@
#include <cpustats/ThreadCpuUsage.h>
#endif
+#ifdef SRS_PROCESSING
+#include "postpro_patch.h"
+#endif
// ----------------------------------------------------------------------------
// Note: the following macro is used for extremely verbose logging message. In
@@ -2727,6 +2749,19 @@ bool AudioFlinger::PlaybackThread::threadLoop()
const String8 myName(String8::format("thread %p type %d TID %d", this, mType, gettid()));
acquireWakeLock();
+#ifdef SRS_PROCESSING
+ String8 bt_param = String8("bluetooth_enabled=0");
+ POSTPRO_PATCH_PARAMS_SET(bt_param);
+ if (mType == MIXER) {
+ POSTPRO_PATCH_OUTPROC_PLAY_INIT(this, myName);
+ } else if (mType == OFFLOAD) {
+ POSTPRO_PATCH_OUTPROC_DIRECT_INIT(this, myName);
+ POSTPRO_PATCH_OUTPROC_PLAY_ROUTE_BY_VALUE(this, mOutDevice);
+ } else if (mType == DIRECT) {
+ POSTPRO_PATCH_OUTPROC_DIRECT_INIT(this, myName);
+ POSTPRO_PATCH_OUTPROC_PLAY_ROUTE_BY_VALUE(this, mOutDevice);
+ }
+#endif
// mNBLogWriter->log can only be called while thread mutex mLock is held.
// So if you need to log when mutex is unlocked, set logString to a non-NULL string,
@@ -2918,7 +2953,13 @@ bool AudioFlinger::PlaybackThread::threadLoop()
effectChains[i]->process_l();
}
}
-
+#ifdef SRS_PROCESSING
+ // Offload thread
+ if (mType == OFFLOAD) {
+ char buffer[2];
+ POSTPRO_PATCH_OUTPROC_DIRECT_SAMPLES(this, AUDIO_FORMAT_PCM_16_BIT, (int16_t *) buffer, 2, 48000, 2);
+ }
+#endif
// Only if the Effects buffer is enabled and there is data in the
// Effects buffer (buffer valid), we need to
// copy into the sink buffer.
@@ -2936,6 +2977,11 @@ bool AudioFlinger::PlaybackThread::threadLoop()
// mSleepTimeUs == 0 means we must write to audio hardware
if (mSleepTimeUs == 0) {
ssize_t ret = 0;
+#ifdef SRS_PROCESSING
+ if (mType == MIXER && mMixerStatus == MIXER_TRACKS_READY) {
+ POSTPRO_PATCH_OUTPROC_PLAY_SAMPLES(this, mFormat, mSinkBuffer, mSinkBufferSize, mSampleRate, mChannelCount);
+ }
+#endif
if (mBytesRemaining) {
ret = threadLoop_write();
if (ret < 0) {
@@ -3032,7 +3078,15 @@ bool AudioFlinger::PlaybackThread::threadLoop()
threadLoop_standby();
mStandby = true;
}
-
+#ifdef SRS_PROCESSING
+ if (mType == MIXER) {
+ POSTPRO_PATCH_OUTPROC_PLAY_EXIT(this, myName);
+ } else if (mType == OFFLOAD) {
+ POSTPRO_PATCH_OUTPROC_DIRECT_EXIT(this, myName);
+ } else if (mType == DIRECT) {
+ POSTPRO_PATCH_OUTPROC_DIRECT_EXIT(this, myName);
+ }
+#endif
releaseWakeLock();
mWakeLockUids.clear();
mActiveTracksGeneration++;
@@ -3126,6 +3180,10 @@ status_t AudioFlinger::PlaybackThread::createAudioPatch_l(const struct audio_pat
type |= patch->sinks[i].ext.device.type;
}
+#ifdef SRS_PROCESSING
+ POSTPRO_PATCH_OUTPROC_PLAY_ROUTE_BY_VALUE(this, type);
+#endif
+
#ifdef ADD_BATTERY_DATA
// when changing the audio output device, call addBatteryData to notify
// the change
@@ -4281,6 +4339,9 @@ bool AudioFlinger::MixerThread::checkForNewParameter_l(const String8& keyValuePa
AudioParameter param = AudioParameter(keyValuePair);
int value;
+#ifdef SRS_PROCESSING
+ POSTPRO_PATCH_OUTPROC_PLAY_ROUTE(this, param, value);
+#endif
if (param.getInt(String8(AudioParameter::keySamplingRate), value) == NO_ERROR) {
reconfig = true;
}
@@ -4821,6 +4882,7 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameter_l(const String8& key
AudioParameter param = AudioParameter(keyValuePair);
int value;
+
if (param.getInt(String8(AudioParameter::keyRouting), value) == NO_ERROR) {
// forward device change to effects that have requested to be
// aware of attached audio device.
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 6182364..48ff77d 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -13,6 +13,24 @@
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
+**
+** This file was modified by DTS, Inc. The portions of the
+** code that are surrounded by "DTS..." are copyrighted and
+** licensed separately, as follows:
+**
+** (C) 2015 DTS, Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
*/
#ifndef INCLUDING_FROM_AUDIOFLINGER_H
@@ -537,7 +555,7 @@ public:
void setMasterVolume(float value);
void setMasterMute(bool muted);
-
+ void setPostPro();
void setStreamVolume(audio_stream_type_t stream, float value);
void setStreamMute(audio_stream_type_t stream, bool muted);