mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1142933 - New audio channel type for system usages. r=baku
This commit is contained in:
parent
f807c52e8e
commit
b70b3b3859
@ -348,6 +348,12 @@ this.PermissionsTable = { geolocation: {
|
||||
privileged: ALLOW_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"audio-channel-system": {
|
||||
app: DENY_ACTION,
|
||||
trusted: DENY_ACTION,
|
||||
privileged: ALLOW_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"audio-channel-telephony": {
|
||||
app: DENY_ACTION,
|
||||
trusted: DENY_ACTION,
|
||||
|
@ -93,6 +93,7 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
int(AUDIO_AGENT_CHANNEL_ALARM) == int(AudioChannel::Alarm) &&
|
||||
int(AUDIO_AGENT_CHANNEL_TELEPHONY) == int(AudioChannel::Telephony) &&
|
||||
int(AUDIO_AGENT_CHANNEL_RINGER) == int(AudioChannel::Ringer) &&
|
||||
int(AUDIO_AGENT_CHANNEL_SYSTEM) == int(AudioChannel::System) &&
|
||||
int(AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION) == int(AudioChannel::Publicnotification),
|
||||
"Enum of channel on nsIAudioChannelAgent.idl should be the same with AudioChannelBinding.h");
|
||||
|
||||
|
@ -29,7 +29,7 @@ interface nsIAudioChannelAgentCallback : nsISupports
|
||||
* 1. Changes to the playable status of this channel.
|
||||
*/
|
||||
|
||||
[uuid(e28e1569-2a44-4f71-9cd0-216874b05d57)]
|
||||
[uuid(ee39a34b-a5c7-4b30-b1ac-cd64ceedef67)]
|
||||
interface nsIAudioChannelAgent : nsISupports
|
||||
{
|
||||
const long AUDIO_AGENT_CHANNEL_NORMAL = 0;
|
||||
@ -39,6 +39,7 @@ interface nsIAudioChannelAgent : nsISupports
|
||||
const long AUDIO_AGENT_CHANNEL_TELEPHONY = 4;
|
||||
const long AUDIO_AGENT_CHANNEL_RINGER = 5;
|
||||
const long AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION = 6;
|
||||
const long AUDIO_AGENT_CHANNEL_SYSTEM = 7;
|
||||
|
||||
const long AUDIO_AGENT_CHANNEL_ERROR = 1000;
|
||||
|
||||
|
@ -181,6 +181,8 @@ cubeb_stream_type ConvertChannelToCubebType(dom::AudioChannel aChannel)
|
||||
return CUBEB_STREAM_TYPE_VOICE_CALL;
|
||||
case dom::AudioChannel::Ringer:
|
||||
return CUBEB_STREAM_TYPE_RING;
|
||||
case dom::AudioChannel::System:
|
||||
return CUBEB_STREAM_TYPE_SYSTEM;
|
||||
case dom::AudioChannel::Publicnotification:
|
||||
return CUBEB_STREAM_TYPE_SYSTEM_ENFORCED;
|
||||
default:
|
||||
|
@ -783,10 +783,6 @@ AudioManager::SetVolumeByCategory(uint32_t aCategory, uint32_t aIndex)
|
||||
}
|
||||
}
|
||||
status = SetStreamVolumeIndex(AUDIO_STREAM_MUSIC, aIndex);
|
||||
if (NS_WARN_IF(NS_FAILED(status))) {
|
||||
return status;
|
||||
}
|
||||
status = SetStreamVolumeIndex(AUDIO_STREAM_SYSTEM, aIndex);
|
||||
break;
|
||||
case VOLUME_NOTIFICATION:
|
||||
status = SetStreamVolumeIndex(AUDIO_STREAM_NOTIFICATION, aIndex);
|
||||
@ -794,6 +790,10 @@ AudioManager::SetVolumeByCategory(uint32_t aCategory, uint32_t aIndex)
|
||||
return status;
|
||||
}
|
||||
status = SetStreamVolumeIndex(AUDIO_STREAM_RING, aIndex);
|
||||
if (NS_WARN_IF(NS_FAILED(status))) {
|
||||
return status;
|
||||
}
|
||||
status = SetStreamVolumeIndex(AUDIO_STREAM_SYSTEM, aIndex);
|
||||
break;
|
||||
case VOLUME_ALARM:
|
||||
status = SetStreamVolumeIndex(AUDIO_STREAM_ALARM, aIndex);
|
||||
@ -814,12 +814,12 @@ AudioManager::GetVolumeByCategory(uint32_t aCategory) const
|
||||
{
|
||||
switch (static_cast<AudioVolumeCategories>(aCategory)) {
|
||||
case VOLUME_MEDIA:
|
||||
MOZ_ASSERT(mCurrentStreamVolumeTbl[AUDIO_STREAM_MUSIC] ==
|
||||
mCurrentStreamVolumeTbl[AUDIO_STREAM_SYSTEM]);
|
||||
return mCurrentStreamVolumeTbl[AUDIO_STREAM_MUSIC];
|
||||
case VOLUME_NOTIFICATION:
|
||||
MOZ_ASSERT(mCurrentStreamVolumeTbl[AUDIO_STREAM_NOTIFICATION] ==
|
||||
mCurrentStreamVolumeTbl[AUDIO_STREAM_RING]);
|
||||
MOZ_ASSERT(mCurrentStreamVolumeTbl[AUDIO_STREAM_NOTIFICATION] ==
|
||||
mCurrentStreamVolumeTbl[AUDIO_STREAM_SYSTEM]);
|
||||
return mCurrentStreamVolumeTbl[AUDIO_STREAM_NOTIFICATION];
|
||||
case VOLUME_ALARM:
|
||||
return mCurrentStreamVolumeTbl[AUDIO_STREAM_ALARM];
|
||||
@ -838,12 +838,12 @@ AudioManager::GetMaxVolumeByCategory(uint32_t aCategory) const
|
||||
{
|
||||
switch (static_cast<AudioVolumeCategories>(aCategory)) {
|
||||
case VOLUME_MEDIA:
|
||||
MOZ_ASSERT(sMaxStreamVolumeTbl[AUDIO_STREAM_MUSIC] ==
|
||||
sMaxStreamVolumeTbl[AUDIO_STREAM_SYSTEM]);
|
||||
return sMaxStreamVolumeTbl[AUDIO_STREAM_MUSIC];
|
||||
case VOLUME_NOTIFICATION:
|
||||
MOZ_ASSERT(sMaxStreamVolumeTbl[AUDIO_STREAM_NOTIFICATION] ==
|
||||
sMaxStreamVolumeTbl[AUDIO_STREAM_RING]);
|
||||
MOZ_ASSERT(sMaxStreamVolumeTbl[AUDIO_STREAM_NOTIFICATION] ==
|
||||
sMaxStreamVolumeTbl[AUDIO_STREAM_SYSTEM]);
|
||||
return sMaxStreamVolumeTbl[AUDIO_STREAM_NOTIFICATION];
|
||||
case VOLUME_ALARM:
|
||||
return sMaxStreamVolumeTbl[AUDIO_STREAM_ALARM];
|
||||
@ -871,6 +871,7 @@ AudioManager::SetAudioChannelVolume(uint32_t aChannel, uint32_t aIndex)
|
||||
case AudioChannel::Notification:
|
||||
case AudioChannel::Ringer:
|
||||
case AudioChannel::Publicnotification:
|
||||
case AudioChannel::System:
|
||||
status = SetVolumeByCategory(VOLUME_NOTIFICATION, aIndex);
|
||||
break;
|
||||
case AudioChannel::Alarm:
|
||||
@ -901,6 +902,7 @@ AudioManager::GetAudioChannelVolume(uint32_t aChannel, uint32_t* aIndex)
|
||||
case AudioChannel::Notification:
|
||||
case AudioChannel::Ringer:
|
||||
case AudioChannel::Publicnotification:
|
||||
case AudioChannel::System:
|
||||
*aIndex = GetVolumeByCategory(VOLUME_NOTIFICATION);
|
||||
break;
|
||||
case AudioChannel::Alarm:
|
||||
@ -931,6 +933,7 @@ AudioManager::GetMaxAudioChannelVolume(uint32_t aChannel, uint32_t* aMaxIndex)
|
||||
case AudioChannel::Notification:
|
||||
case AudioChannel::Ringer:
|
||||
case AudioChannel::Publicnotification:
|
||||
case AudioChannel::System:
|
||||
*aMaxIndex = GetMaxVolumeByCategory(VOLUME_NOTIFICATION);
|
||||
break;
|
||||
case AudioChannel::Alarm:
|
||||
|
@ -46,4 +46,5 @@ enum AudioChannel {
|
||||
"telephony",
|
||||
"ringer",
|
||||
"publicnotification",
|
||||
"system"
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user