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

Commit ad3183e2 authored by François Gaffie's avatar François Gaffie Committed by Jean-Michel Trivi
Browse files

Audio Policy Refactor: reorganise headers inclusion



This patch reoganises the headers inclusion in order to prepare
the split of managerdefault into a manager and a separated lib
of pillar policy elements.

It also moves back the isStrategyActive to the manager to avoid
any dependancies from this pillars to the manager.

Change-Id: I1a35c45d86db7a3878a40dc7d6858dfea37c5ac9
Signed-off-by: default avatarFrançois Gaffie <francois.gaffie@intel.com>
parent 4de725a3
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