Lines Matching refs:stream

290         for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
291 handleIncallSonification(stream, false, true);
372 for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
373 handleIncallSonification(stream, true, true);
508 audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type stream,
516 routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
518 ALOGV("getOutput() stream %d, samplingRate %d, format %d, channelMask %x, flags %x",
519 stream, samplingRate, format, channelMask, flags);
535 outputDesc->mRefCount[stream] = 0;
570 outputDesc->mRefCount[stream] = 0;
571 outputDesc->mStopTime[stream] = 0;
604 // get which output is suitable for the specified stream. The actual routing change will happen
610 ALOGW_IF((output ==0), "getOutput() could not find output for stream %d, samplingRate %d,"
611 "format %d, channels %x, flags %x", stream, samplingRate, format, channelMask, flags);
665 AudioSystem::stream_type stream,
668 ALOGV("startOutput() output %d, stream %d, session %d", output, stream, session);
677 // increment usage count for this stream on the requested output:
680 outputDesc->changeRefCount(stream, 1);
682 if (outputDesc->mRefCount[stream] == 1) {
684 routing_strategy strategy = getStrategy(stream);
711 handleIncallSonification(stream, true, false);
714 // apply volume rules for current stream and device if necessary
715 checkAndSetVolume(stream,
716 mStreams[stream].getVolumeIndex(newDevice),
720 // update the outputs if starting an output with a stream that can affect notification
722 handleNotificationRoutingForStream(stream);
732 AudioSystem::stream_type stream,
735 ALOGV("stopOutput() output %d, stream %d, session %d", output, stream, session);
746 handleIncallSonification(stream, false, false);
749 if (outputDesc->mRefCount[stream] > 0) {
750 // decrement usage count of this stream on the output
751 outputDesc->changeRefCount(stream, -1);
752 // store time at which the stream was stopped - see isStreamActive()
753 if (outputDesc->mRefCount[stream] == 0) {
754 outputDesc->mStopTime[stream] = systemTime();
778 // update the outputs if stopping one with a stream that can affect notification routing
779 handleNotificationRoutingForStream(stream);
968 void AudioPolicyManagerBase::initStreamVolume(AudioSystem::stream_type stream,
972 ALOGV("initStreamVolume() stream %d, min %d, max %d", stream , indexMin, indexMax);
974 ALOGW("initStreamVolume() invalid index limits for stream %d, min %d, max %d", stream , indexMin, indexMax);
977 mStreams[stream].mIndexMin = indexMin;
978 mStreams[stream].mIndexMax = indexMax;
981 status_t AudioPolicyManagerBase::setStreamVolumeIndex(AudioSystem::stream_type stream,
986 if ((index < mStreams[stream].mIndexMin) || (index > mStreams[stream].mIndexMax)) {
993 // Force max volume if stream cannot be muted
994 if (!mStreams[stream].mCanBeMuted) index = mStreams[stream].mIndexMax;
996 ALOGV("setStreamVolumeIndex() stream %d, device %04x, index %d",
997 stream, device, index);
1002 mStreams[stream].mIndexCur.clear();
1004 mStreams[stream].mIndexCur.add(device, index);
1006 // compute and apply stream volume on all outputs according to connected device
1012 status_t volStatus = checkAndSetVolume(stream, index, mOutputs.keyAt(i), curDevice);
1021 status_t AudioPolicyManagerBase::getStreamVolumeIndex(AudioSystem::stream_type stream,
1032 // the strategy the stream belongs to.
1034 device = getDeviceForStrategy(getStrategy(stream), true /*fromCache*/);
1038 *index = mStreams[stream].getVolumeIndex(device);
1039 ALOGV("getStreamVolumeIndex() stream %d device %08x index %d", stream, device, *index);
1165 bool AudioPolicyManagerBase::isStreamActive(int stream, uint32_t inPastMs) const
1169 if (mOutputs.valueAt(i)->mRefCount[stream] != 0 ||
1170 ns2ms(sysTime - mOutputs.valueAt(i)->mStopTime[stream]) < inPastMs) {
1526 ALOGE("Failed to reopen hardware output stream, samplingRate: %d, format %d, channels %d",
1683 // set initial stream volume for device
1791 // count for their stream type must be adjusted accordingly on
2009 uint32_t AudioPolicyManagerBase::getStrategyForStream(AudioSystem::stream_type stream) {
2010 return (uint32_t)getStrategy(stream);
2013 audio_devices_t AudioPolicyManagerBase::getDevicesForStream(AudioSystem::stream_type stream) {
2015 // By checking the range of stream before calling getStrategy, we avoid
2018 if (stream < (AudioSystem::stream_type) 0 || stream >= AudioSystem::NUM_STREAM_TYPES) {
2021 AudioPolicyManagerBase::routing_strategy strategy = getStrategy(stream);
2028 AudioSystem::stream_type stream) {
2029 // stream to strategy mapping
2030 switch (stream) {
2042 ALOGE("unknown stream type");
2044 // NOTE: SYSTEM stream uses MEDIA strategy because muting music and switching outputs
2054 void AudioPolicyManagerBase::handleNotificationRoutingForStream(AudioSystem::stream_type stream) {
2055 switch(stream) {
2391 // update stream volumes according to new device
2546 // the volume index in the UI is relative to the min and max volume indices for this stream type
2695 float AudioPolicyManagerBase::computeVolume(int stream,
2702 StreamDescriptor &streamDesc = mStreams[stream];
2709 if (stream == AudioSystem::MUSIC &&
2710 index != mStreams[stream].mIndexMin &&
2725 const routing_strategy stream_strategy = getStrategy((AudioSystem::stream_type)stream);
2732 || (stream == AudioSystem::SYSTEM)
2759 status_t AudioPolicyManagerBase::checkAndSetVolume(int stream,
2767 // do not change actual stream volume if the stream is muted
2768 if (mOutputs.valueFor(output)->mMuteCount[stream] != 0) {
2769 ALOGVV("checkAndSetVolume() stream %d muted count %d",
2770 stream, mOutputs.valueFor(output)->mMuteCount[stream]);
2775 if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) ||
2776 (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) {
2777 ALOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
2778 stream, mForceUse[AudioSystem::FOR_COMMUNICATION]);
2782 float volume = computeVolume(stream, index, output, device);
2786 if (volume != mOutputs.valueFor(output)->mCurVolume[stream] ||
2788 mOutputs.valueFor(output)->mCurVolume[stream] = volume;
2789 ALOGVV("checkAndSetVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
2790 // Force VOICE_CALL to track BLUETOOTH_SCO stream volume when bluetooth audio is
2792 if (stream == AudioSystem::BLUETOOTH_SCO) {
2795 mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
2798 if (stream == AudioSystem::VOICE_CALL ||
2799 stream == AudioSystem::BLUETOOTH_SCO) {
2802 if (stream == AudioSystem::VOICE_CALL) {
2803 voiceVolume = (float)index/(float)mStreams[stream].mIndexMax;
2824 for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
2825 checkAndSetVolume(stream,
2826 mStreams[stream].getVolumeIndex(device),
2841 for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
2842 if (getStrategy((AudioSystem::stream_type)stream) == strategy) {
2843 setStreamMute(stream, on, output, delayMs, device);
2848 void AudioPolicyManagerBase::setStreamMute(int stream,
2854 StreamDescriptor &streamDesc = mStreams[stream];
2860 ALOGVV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d device %04x",
2861 stream, on, output, outputDesc->mMuteCount[stream], device);
2864 if (outputDesc->mMuteCount[stream] == 0) {
2866 ((stream != AudioSystem::ENFORCED_AUDIBLE) ||
2868 checkAndSetVolume(stream, 0, output, device, delayMs);
2872 outputDesc->mMuteCount[stream]++;
2874 if (outputDesc->mMuteCount[stream] == 0) {
2875 ALOGV("setStreamMute() unmuting non muted stream!");
2878 if (--outputDesc->mMuteCount[stream] == 0) {
2879 checkAndSetVolume(stream,
2888 void AudioPolicyManagerBase::handleIncallSonification(int stream, bool starting, bool stateChange)
2890 // if the stream pertains to sonification strategy and we are in call we must
2891 // mute the stream if it is low visibility. If it is high visibility, we must play a tone
2896 const routing_strategy stream_strategy = getStrategy((AudioSystem::stream_type)stream);
2900 ALOGV("handleIncallSonification() stream %d starting %d device %x stateChange %d",
2901 stream, starting, outputDesc->mDevice, stateChange);
2902 if (outputDesc->mRefCount[stream]) {
2905 muteCount = outputDesc->mRefCount[stream];
2907 if (AudioSystem::isLowVisibility((AudioSystem::stream_type)stream)) {
2910 setStreamMute(stream, starting, mPrimaryOutput);
2918 setStreamMute(stream, starting, mPrimaryOutput);
2941 bool AudioPolicyManagerBase::needsDirectOuput(audio_stream_type_t stream,
2971 // clear usage count for all stream types
3019 void AudioPolicyManagerBase::AudioOutputDescriptor::changeRefCount(AudioSystem::stream_type stream, int delta)
3023 mOutput1->changeRefCount(stream, delta);
3024 mOutput2->changeRefCount(stream, delta);
3026 if ((delta + (int)mRefCount[stream]) < 0) {
3027 ALOGW("changeRefCount() invalid delta %d for stream %d, refCount %d", delta, stream, mRefCount[stream]);
3028 mRefCount[stream] = 0;
3031 mRefCount[stream] += delta;
3032 ALOGV("changeRefCount() stream %d, count %d", stream, mRefCount[stream]);
3447 // rates should be read from the output stream after it is opened for the first time
3469 // should be read from the output stream after it is opened for the first time
3519 // masks should be read from the output stream after it is opened for the first time