Android新增STREAM_A2DP流类型,适用于蓝牙音乐,等于在android上层独立出一条音频通道,audioFIinger可以根据流类型做策略。
diff --git a/frameworks/av/include/media/AudioPolicyHelper.h b/frameworks/av/include/media/AudioPolicyHelper.h
old mode 100644
new mode 100755
index 79231be..c19d5f2
--- a/frameworks/av/include/media/AudioPolicyHelper.h
+++ b/frameworks/av/include/media/AudioPolicyHelper.h
@@ -55,6 +55,9 @@ static audio_stream_type_t audio_attributes_to_stream_type(const audio_attribute
case AUDIO_USAGE_NOTIFICATION_EVENT:
return AUDIO_STREAM_NOTIFICATION;
+ case AUDIO_USAGE_A2DP:
+ return AUDIO_STREAM_A2DP;
+
case AUDIO_USAGE_UNKNOWN:
default:
return AUDIO_STREAM_MUSIC;
@@ -107,6 +110,9 @@ static void stream_type_to_audio_attributes(audio_stream_type_t streamType,
attr->content_type = AUDIO_CONTENT_TYPE_SPEECH;
attr->usage = AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY;
break;
+ case AUDIO_STREAM_A2DP:
+ attr->content_type = AUDIO_CONTENT_TYPE_A2DP;
+ attr->usage = AUDIO_USAGE_A2DP;
default:
ALOGE("invalid stream type %d when converting to attributes", streamType);
}
diff --git a/frameworks/av/media/libmedia/AudioSystem.cpp b/frameworks/av/media/libmedia/AudioSystem.cpp
old mode 100644
new mode 100755
diff --git a/frameworks/av/media/libmedia/AudioTrack.cpp b/frameworks/av/media/libmedia/AudioTrack.cpp
old mode 100644
new mode 100755
index e23091c..ceefb68
--- a/frameworks/av/media/libmedia/AudioTrack.cpp
+++ b/frameworks/av/media/libmedia/AudioTrack.cpp
@@ -375,7 +375,6 @@ status_t AudioTrack::set(
flags = (audio_output_flags_t) (flags | AUDIO_OUTPUT_FLAG_FAST);
}
}
-
// these below should probably come from the audioFlinger too...
if (format == AUDIO_FORMAT_DEFAULT) {
format = AUDIO_FORMAT_PCM_16_BIT;
diff --git a/frameworks/av/media/libmedia/IMediaPlayer.cpp b/frameworks/av/media/libmedia/IMediaPlayer.cpp
old mode 100644
new mode 100755
diff --git a/frameworks/av/media/libmediaplayerservice/MediaPlayerService.cpp b/frameworks/av/media/libmediaplayerservice/MediaPlayerService.cpp
old mode 100644
new mode 100755
diff --git a/frameworks/av/services/audioflinger/Threads.cpp b/frameworks/av/services/audioflinger/Threads.cpp
index 938fbcf..ca6c6b7 100755
--- a/frameworks/av/services/audioflinger/Threads.cpp
+++ b/frameworks/av/services/audioflinger/Threads.cpp
@@ -4084,6 +4084,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac
mEffectBufferValid = false; // mEffectBuffer has no valid data until tracks found.
phoneMixer();
+ //ALOGW("mIsPhoneOn = %d", mIsPhoneOn);
for (size_t i=0 ; i t = mActiveTracks[i].promote();
@@ -4360,7 +4361,6 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac
typeVolume *= 0;
}
}
- ALOGW("mIsPhoneOn = %d, typeVolume = %f", mIsPhoneOn, typeVolume);
float v = masterVolume * typeVolume;
diff --git a/frameworks/av/services/audioflinger/Tracks.cpp b/frameworks/av/services/audioflinger/Tracks.cpp
old mode 100644
new mode 100755
diff --git a/frameworks/av/services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h b/frameworks/av/services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h
old mode 100644
new mode 100755
diff --git a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/Gains.cpp b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/Gains.cpp
old mode 100644
new mode 100755
index e3fc9a8..cb7d8e9
--- a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/Gains.cpp
+++ b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/Gains.cpp
@@ -176,6 +176,12 @@ const VolumeCurvePoint *Gains::sVolumeProfiles[AUDIO_STREAM_CNT]
Gains::sSilentVolumeCurve, // DEVICE_CATEGORY_EARPIECE
Gains::sSilentVolumeCurve // DEVICE_CATEGORY_EXT_MEDIA
},
+ { // AUDIO_STREAM_A2DP
+ Gains::sDefaultMediaVolumeCurve, // DEVICE_CATEGORY_HEADSET
+ Gains::sSpeakerMediaVolumeCurve, // DEVICE_CATEGORY_SPEAKER
+ Gains::sDefaultMediaVolumeCurve, // DEVICE_CATEGORY_EARPIECE
+ Gains::sDefaultMediaVolumeCurve // DEVICE_CATEGORY_EXT_MEDIA
+ },
{ // AUDIO_STREAM_ACCESSIBILITY
Gains::sDefaultMediaVolumeCurve, // DEVICE_CATEGORY_HEADSET
Gains::sSpeakerMediaVolumeCurve, // DEVICE_CATEGORY_SPEAKER
diff --git a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
old mode 100644
new mode 100755
diff --git a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
old mode 100644
new mode 100755
index b3019e1..f635a1e
--- a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
+++ b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
@@ -190,6 +190,8 @@ void StreamDescriptorCollection::initializeVolumeCurves(bool isSpeakerDrcEnabled
Gains::sSpeakerSonificationVolumeCurveDrc);
setVolumeCurvePoint(AUDIO_STREAM_MUSIC, DEVICE_CATEGORY_SPEAKER,
Gains::sSpeakerMediaVolumeCurveDrc);
+ setVolumeCurvePoint(AUDIO_STREAM_A2DP, DEVICE_CATEGORY_SPEAKER,
+ Gains::sSpeakerMediaVolumeCurveDrc);
setVolumeCurvePoint(AUDIO_STREAM_ACCESSIBILITY, DEVICE_CATEGORY_SPEAKER,
Gains::sSpeakerMediaVolumeCurveDrc);
}
diff --git a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp
old mode 100644
new mode 100755
index 48bfd79..727390d
--- a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp
+++ b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp
@@ -223,6 +223,7 @@ const StreamTypeConverter::Table StreamTypeConverter::mTable[] = {
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_ENFORCED_AUDIBLE),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_DTMF),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_TTS),
+ MAKE_STRING_FROM_ENUM(AUDIO_STREAM_A2DP),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_ACCESSIBILITY),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_REROUTING),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_PATCH),
diff --git a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp
old mode 100644
new mode 100755
index 14caf7c..0bc1252
--- a/frameworks/av/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp
+++ b/frameworks/av/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp
@@ -25,7 +25,7 @@ namespace android {
float VolumeCurve::volIndexToDb(int indexInUi, int volIndexMin, int volIndexMax) const
{
ALOG_ASSERT(!mCurvePoints.isEmpty(), "Invalid volume curve");
-
+
size_t nbCurvePoints = mCurvePoints.size();
// the volume index in the UI is relative to the min and max volume indices for this stream
int nbSteps = 1 + mCurvePoints[nbCurvePoints - 1].mIndex - mCurvePoints[0].mIndex;
diff --git a/frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml b/frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml
old mode 100644
new mode 100755
index 43a47b0..5c43ea4
--- a/frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml
+++ b/frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml
@@ -151,6 +151,14 @@ volume index from 0 to 100.
ref="SILENT_VOLUME_CURVE"/>
+
+
+
+