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

Commit a4f00e2a authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

AudioMixer: Cleanups

- remove unused ARRAY_SIZE;

- fix indentation for TIMESTRETCH in setParameter;

- move trackNames method implementation and BLOCKSIZE constant
  into .cpp file;

- whitespace fixes.

Test: make
Merged-In: Idc5da55c8c3af0d59b9a7a12d081747b0a99dafc
Change-Id: Idc5da55c8c3af0d59b9a7a12d081747b0a99dafc
parent 9b6599e1
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include <map>
#include <pthread.h>
#include <sstream>
#include <string>
#include <stdint.h>
#include <sys/types.h>
#include <unordered_map>
@@ -176,13 +176,7 @@ public:

    size_t      getUnreleasedFrames(int name) const;

    std::string trackNames() const {
        std::stringstream ss;
        for (const auto &pair : mTracks) {
            ss << pair.first << " ";
        }
        return ss.str();
    }
    std::string trackNames() const;

    static inline bool isValidFormat(audio_format_t format) {
        switch (format) {
@@ -449,9 +443,6 @@ private:
        void track__NoResample(TO* out, size_t frameCount, TO* temp __unused, TA* aux);
    };

    // TODO: remove BLOCKSIZE unit of processing - it isn't needed anymore.
    static constexpr int BLOCKSIZE = 16;

    bool setChannelMasks(int name,
            audio_channel_mask_t trackChannelMask, audio_channel_mask_t mixerChannelMask);

+35 −27
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "AudioMixer"
//#define LOG_NDEBUG 0

#include <sstream>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
@@ -58,10 +59,6 @@
#define ALOGVV(a...) do { } while (0)
#endif

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
#endif

// Set kUseNewMixer to true to use the new mixer engine always. Otherwise the
// original code will be used for stereo sinks, the new mixer for multichannel.
static constexpr bool kUseNewMixer = true;
@@ -79,8 +76,11 @@ static_assert(kUseNewMixer && kUseFloat,
using TYPE_AUX = int32_t; // q4.27
#endif

// TODO: remove BLOCKSIZE unit of processing - it isn't needed anymore.
static constexpr int BLOCKSIZE = 16;

// Set to default copy buffer size in frames for input processing.
static const size_t kCopyBufferFrameCount = 256;
static constexpr size_t kCopyBufferFrameCount = 256;

namespace android {

@@ -949,6 +949,14 @@ size_t AudioMixer::getUnreleasedFrames(int name) const
    return 0;
}

std::string AudioMixer::trackNames() const {
    std::stringstream ss;
    for (const auto &pair : mTracks) {
        ss << pair.first << " ";
    }
    return ss.str();
}

void AudioMixer::setBufferProvider(int name, AudioBufferProvider* bufferProvider)
{
    LOG_ALWAYS_FATAL_IF(!exists(name), "invalid name: %d", name);