Loading services/audioflinger/AudioFlinger.cpp +1 −20 Original line number Original line Diff line number Diff line Loading @@ -126,8 +126,6 @@ static constexpr char kNoEffectsFactory[] = "Effects Factory is absent\n"; static constexpr char kAudioServiceName[] = "audio"; static constexpr char kAudioServiceName[] = "audio"; nsecs_t AudioFlinger::mStandbyTimeInNsecs = kDefaultStandbyTimeInNsecs; // In order to avoid invalidating offloaded tracks each time a Visualizer is turned on and off // In order to avoid invalidating offloaded tracks each time a Visualizer is turned on and off // we define a minimum time during which a global effect is considered enabled. // we define a minimum time during which a global effect is considered enabled. static const nsecs_t kMinGlobalEffectEnabletimeNs = seconds(7200); static const nsecs_t kMinGlobalEffectEnabletimeNs = seconds(7200); Loading Loading @@ -343,20 +341,6 @@ void AudioFlinger::onFirstRef() { { Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); /* TODO: move all this work into an Init() function */ char val_str[PROPERTY_VALUE_MAX] = { 0 }; if (property_get("ro.audio.flinger_standbytime_ms", val_str, NULL) >= 0) { uint32_t int_val; if (1 == sscanf(val_str, "%u", &int_val)) { mStandbyTimeInNsecs = milliseconds(int_val); ALOGI("Using %u mSec as standby time.", int_val); } else { mStandbyTimeInNsecs = kDefaultStandbyTimeInNsecs; ALOGI("Using default %u mSec as standby time.", (uint32_t)(mStandbyTimeInNsecs / 1000000)); } } mMode = AUDIO_MODE_NORMAL; mMode = AUDIO_MODE_NORMAL; gAudioFlinger = this; // we are already refcounted, store into atomic pointer. gAudioFlinger = this; // we are already refcounted, store into atomic pointer. Loading Loading @@ -760,10 +744,7 @@ void AudioFlinger::dumpInternals(int fd, const Vector<String16>& args __unused) String8 result; String8 result; hardware_call_state hardwareStatus = mHardwareStatus; hardware_call_state hardwareStatus = mHardwareStatus; snprintf(buffer, SIZE, "Hardware status: %d\n" snprintf(buffer, SIZE, "Hardware status: %d\n", hardwareStatus); "Standby Time mSec: %u\n", hardwareStatus, (uint32_t)(mStandbyTimeInNsecs / 1000000)); result.append(buffer); result.append(buffer); write(fd, result.c_str(), result.size()); write(fd, result.c_str(), result.size()); Loading services/audioflinger/AudioFlinger.h +0 −6 Original line number Original line Diff line number Diff line Loading @@ -149,8 +149,6 @@ class ServerProxy; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- static const nsecs_t kDefaultStandbyTimeInNsecs = seconds(3); using android::content::AttributionSourceState; using android::content::AttributionSourceState; struct stream_type_t { struct stream_type_t { Loading Loading @@ -559,10 +557,6 @@ public: } } } } // standby delay for MIXER and DUPLICATING playback threads is read from property // ro.audio.flinger_standbytime_ms or defaults to kDefaultStandbyTimeInNsecs static nsecs_t mStandbyTimeInNsecs; private: private: // incremented by 2 when screen state changes, bit 0 == 1 means "off" // incremented by 2 when screen state changes, bit 0 == 1 means "off" Loading services/audioflinger/Threads.cpp +14 −2 Original line number Original line Diff line number Diff line Loading @@ -245,6 +245,18 @@ static int sFastTrackMultiplier = kFastTrackMultiplier; // and that all "fast" AudioRecord clients read from. In either case, the size can be small. // and that all "fast" AudioRecord clients read from. In either case, the size can be small. static const size_t kRecordThreadReadOnlyHeapSize = 0xD000; static const size_t kRecordThreadReadOnlyHeapSize = 0xD000; static constexpr nsecs_t kDefaultStandbyTimeInNsecs = seconds(3); static nsecs_t getStandbyTimeInNanos() { static nsecs_t standbyTimeInNanos = []() { const int ms = property_get_int32("ro.audio.flinger_standbytime_ms", kDefaultStandbyTimeInNsecs / NANOS_PER_MILLISECOND); ALOGI("%s: Using %d ms as standby time", __func__, ms); return milliseconds(ms); }(); return standbyTimeInNanos; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // TODO: move all toString helpers to audio.h // TODO: move all toString helpers to audio.h Loading Loading @@ -2085,7 +2097,7 @@ PlaybackThread::PlaybackThread(const sp<IAfThreadCallback>& afThreadCallback, mNumWrites(0), mNumDelayedWrites(0), mInWrite(false), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false), mMixerStatus(MIXER_IDLE), mMixerStatus(MIXER_IDLE), mMixerStatusIgnoringFastTracks(MIXER_IDLE), mMixerStatusIgnoringFastTracks(MIXER_IDLE), mStandbyDelayNs(AudioFlinger::mStandbyTimeInNsecs), mStandbyDelayNs(getStandbyTimeInNanos()), mBytesRemaining(0), mBytesRemaining(0), mCurrentWriteLength(0), mCurrentWriteLength(0), mUseAsyncWrite(false), mUseAsyncWrite(false), Loading Loading @@ -3558,7 +3570,7 @@ void PlaybackThread::cacheParameters_l() mActiveSleepTimeUs = activeSleepTimeUs(); mActiveSleepTimeUs = activeSleepTimeUs(); mIdleSleepTimeUs = idleSleepTimeUs(); mIdleSleepTimeUs = idleSleepTimeUs(); mStandbyDelayNs = AudioFlinger::mStandbyTimeInNsecs; mStandbyDelayNs = getStandbyTimeInNanos(); // make sure standby delay is not too short when connected to an A2DP sink to avoid // make sure standby delay is not too short when connected to an A2DP sink to avoid // truncating audio when going to standby. // truncating audio when going to standby. Loading Loading
services/audioflinger/AudioFlinger.cpp +1 −20 Original line number Original line Diff line number Diff line Loading @@ -126,8 +126,6 @@ static constexpr char kNoEffectsFactory[] = "Effects Factory is absent\n"; static constexpr char kAudioServiceName[] = "audio"; static constexpr char kAudioServiceName[] = "audio"; nsecs_t AudioFlinger::mStandbyTimeInNsecs = kDefaultStandbyTimeInNsecs; // In order to avoid invalidating offloaded tracks each time a Visualizer is turned on and off // In order to avoid invalidating offloaded tracks each time a Visualizer is turned on and off // we define a minimum time during which a global effect is considered enabled. // we define a minimum time during which a global effect is considered enabled. static const nsecs_t kMinGlobalEffectEnabletimeNs = seconds(7200); static const nsecs_t kMinGlobalEffectEnabletimeNs = seconds(7200); Loading Loading @@ -343,20 +341,6 @@ void AudioFlinger::onFirstRef() { { Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); /* TODO: move all this work into an Init() function */ char val_str[PROPERTY_VALUE_MAX] = { 0 }; if (property_get("ro.audio.flinger_standbytime_ms", val_str, NULL) >= 0) { uint32_t int_val; if (1 == sscanf(val_str, "%u", &int_val)) { mStandbyTimeInNsecs = milliseconds(int_val); ALOGI("Using %u mSec as standby time.", int_val); } else { mStandbyTimeInNsecs = kDefaultStandbyTimeInNsecs; ALOGI("Using default %u mSec as standby time.", (uint32_t)(mStandbyTimeInNsecs / 1000000)); } } mMode = AUDIO_MODE_NORMAL; mMode = AUDIO_MODE_NORMAL; gAudioFlinger = this; // we are already refcounted, store into atomic pointer. gAudioFlinger = this; // we are already refcounted, store into atomic pointer. Loading Loading @@ -760,10 +744,7 @@ void AudioFlinger::dumpInternals(int fd, const Vector<String16>& args __unused) String8 result; String8 result; hardware_call_state hardwareStatus = mHardwareStatus; hardware_call_state hardwareStatus = mHardwareStatus; snprintf(buffer, SIZE, "Hardware status: %d\n" snprintf(buffer, SIZE, "Hardware status: %d\n", hardwareStatus); "Standby Time mSec: %u\n", hardwareStatus, (uint32_t)(mStandbyTimeInNsecs / 1000000)); result.append(buffer); result.append(buffer); write(fd, result.c_str(), result.size()); write(fd, result.c_str(), result.size()); Loading
services/audioflinger/AudioFlinger.h +0 −6 Original line number Original line Diff line number Diff line Loading @@ -149,8 +149,6 @@ class ServerProxy; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- static const nsecs_t kDefaultStandbyTimeInNsecs = seconds(3); using android::content::AttributionSourceState; using android::content::AttributionSourceState; struct stream_type_t { struct stream_type_t { Loading Loading @@ -559,10 +557,6 @@ public: } } } } // standby delay for MIXER and DUPLICATING playback threads is read from property // ro.audio.flinger_standbytime_ms or defaults to kDefaultStandbyTimeInNsecs static nsecs_t mStandbyTimeInNsecs; private: private: // incremented by 2 when screen state changes, bit 0 == 1 means "off" // incremented by 2 when screen state changes, bit 0 == 1 means "off" Loading
services/audioflinger/Threads.cpp +14 −2 Original line number Original line Diff line number Diff line Loading @@ -245,6 +245,18 @@ static int sFastTrackMultiplier = kFastTrackMultiplier; // and that all "fast" AudioRecord clients read from. In either case, the size can be small. // and that all "fast" AudioRecord clients read from. In either case, the size can be small. static const size_t kRecordThreadReadOnlyHeapSize = 0xD000; static const size_t kRecordThreadReadOnlyHeapSize = 0xD000; static constexpr nsecs_t kDefaultStandbyTimeInNsecs = seconds(3); static nsecs_t getStandbyTimeInNanos() { static nsecs_t standbyTimeInNanos = []() { const int ms = property_get_int32("ro.audio.flinger_standbytime_ms", kDefaultStandbyTimeInNsecs / NANOS_PER_MILLISECOND); ALOGI("%s: Using %d ms as standby time", __func__, ms); return milliseconds(ms); }(); return standbyTimeInNanos; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // TODO: move all toString helpers to audio.h // TODO: move all toString helpers to audio.h Loading Loading @@ -2085,7 +2097,7 @@ PlaybackThread::PlaybackThread(const sp<IAfThreadCallback>& afThreadCallback, mNumWrites(0), mNumDelayedWrites(0), mInWrite(false), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false), mMixerStatus(MIXER_IDLE), mMixerStatus(MIXER_IDLE), mMixerStatusIgnoringFastTracks(MIXER_IDLE), mMixerStatusIgnoringFastTracks(MIXER_IDLE), mStandbyDelayNs(AudioFlinger::mStandbyTimeInNsecs), mStandbyDelayNs(getStandbyTimeInNanos()), mBytesRemaining(0), mBytesRemaining(0), mCurrentWriteLength(0), mCurrentWriteLength(0), mUseAsyncWrite(false), mUseAsyncWrite(false), Loading Loading @@ -3558,7 +3570,7 @@ void PlaybackThread::cacheParameters_l() mActiveSleepTimeUs = activeSleepTimeUs(); mActiveSleepTimeUs = activeSleepTimeUs(); mIdleSleepTimeUs = idleSleepTimeUs(); mIdleSleepTimeUs = idleSleepTimeUs(); mStandbyDelayNs = AudioFlinger::mStandbyTimeInNsecs; mStandbyDelayNs = getStandbyTimeInNanos(); // make sure standby delay is not too short when connected to an A2DP sink to avoid // make sure standby delay is not too short when connected to an A2DP sink to avoid // truncating audio when going to standby. // truncating audio when going to standby. Loading