Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07a4422d authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Audio Policy Refactor: reorganise headers inclusion"

parents d618d835 ad3183e2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
 * limitations under the License.
 */

#pragma once

namespace android {

enum routing_strategy {
+5 −1
Original line number Diff line number Diff line
@@ -17,7 +17,11 @@
#define LOG_TAG "APM::AudioInputDescriptor"
//#define LOG_NDEBUG 0

#include "AudioPolicyManager.h"
#include "AudioInputDescriptor.h"
#include "IOProfile.h"
#include "Gains.h"
#include "HwModule.h"
#include <media/AudioPolicy.h>

namespace android {

+10 −0
Original line number Diff line number Diff line
@@ -14,8 +14,18 @@
 * limitations under the License.
 */

#pragma once

#include "Ports.h"
#include <utils/Errors.h>
#include <system/audio.h>
#include <utils/SortedVector.h>

namespace android {

class IOProfile;
class AudioMix;

// descriptor for audio inputs. Used to maintain current configuration of each opened audio input
// and keep track of the usage of this input.
class AudioInputDescriptor: public AudioPortConfig
+8 −12
Original line number Diff line number Diff line
@@ -17,7 +17,11 @@
#define LOG_TAG "APM::AudioOutputDescriptor"
//#define LOG_NDEBUG 0

#include "AudioPolicyManager.h"
#include "AudioOutputDescriptor.h"
#include "IOProfile.h"
#include "Gains.h"
#include "HwModule.h"
#include <media/AudioPolicy.h>

namespace android {

@@ -108,23 +112,15 @@ audio_devices_t AudioOutputDescriptor::supportedDevices()

bool AudioOutputDescriptor::isActive(uint32_t inPastMs) const
{
    return isStrategyActive(NUM_STRATEGIES, inPastMs);
}

bool AudioOutputDescriptor::isStrategyActive(routing_strategy strategy,
                                                                       uint32_t inPastMs,
                                                                       nsecs_t sysTime) const
{
    if ((sysTime == 0) && (inPastMs != 0)) {
    nsecs_t sysTime = 0;
    if (inPastMs != 0) {
        sysTime = systemTime();
    }
    for (int i = 0; i < (int)AUDIO_STREAM_CNT; i++) {
        if (i == AUDIO_STREAM_PATCH) {
            continue;
        }
        if (((AudioPolicyManager::getStrategy((audio_stream_type_t)i) == strategy) ||
                (NUM_STRATEGIES == strategy)) &&
                isStreamActive((audio_stream_type_t)i, inPastMs, sysTime)) {
        if (isStreamActive((audio_stream_type_t)i, inPastMs, sysTime)) {
            return true;
        }
    }
+9 −3
Original line number Diff line number Diff line
@@ -14,10 +14,19 @@
 * limitations under the License.
 */

#pragma once

#include "Ports.h"
#include "ApmImplDefinitions.h"
#include <utils/Errors.h>
#include <utils/Timers.h>
#include <system/audio.h>

namespace android {

class IOProfile;
class AudioMix;

// descriptor for audio outputs. Used to maintain current configuration of each opened audio output
// and keep track of the usage of this output by each audio stream type.
class AudioOutputDescriptor: public AudioPortConfig
@@ -38,9 +47,6 @@ public:
    bool isStreamActive(audio_stream_type_t stream,
                        uint32_t inPastMs = 0,
                        nsecs_t sysTime = 0) const;
    bool isStrategyActive(routing_strategy strategy,
                     uint32_t inPastMs = 0,
                     nsecs_t sysTime = 0) const;

    virtual void toAudioPortConfig(struct audio_port_config *dstConfig,
                           const struct audio_port_config *srcConfig = NULL) const;
Loading