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

Commit eea7451c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AAudio: Fix channel rate conversion in flowgraph" into main

parents 6cd79803 e8b58967
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -89,9 +89,9 @@ aaudio_result_t AAudioFlowGraph::configure(audio_format_t sourceFormat,
    }

    if (sourceSampleRate != sinkSampleRate) {
        mResampler.reset(aaudio::resampler::MultiChannelResampler::make(sinkChannelCount,
        mResampler.reset(aaudio::resampler::MultiChannelResampler::make(sourceChannelCount,
                sourceSampleRate, sinkSampleRate, resamplerQuality));
        mRateConverter = std::make_unique<SampleRateConverter>(sinkChannelCount,
        mRateConverter = std::make_unique<SampleRateConverter>(sourceChannelCount,
                                                               *mResampler);
        lastOutput->connect(&mRateConverter->input);
        lastOutput = &mRateConverter->output;
+1 −4
Original line number Diff line number Diff line
@@ -134,8 +134,6 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {

    request.getConfiguration().setBufferCapacity(builder.getBufferCapacity());

    mDeviceChannelCount = getSamplesPerFrame(); // Assume it will be the same. Update if not.

    mServiceStreamHandleInfo = mServiceInterface.openStream(request, configurationOutput);
    if (getServiceHandle() < 0
            && (request.getConfiguration().getSamplesPerFrame() == 1
@@ -179,8 +177,6 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
        setChannelMask(configurationOutput.getChannelMask());
    }

    mDeviceChannelCount = configurationOutput.getSamplesPerFrame();

    setDeviceId(configurationOutput.getDeviceId());
    setSessionId(configurationOutput.getSessionId());
    setSharingMode(configurationOutput.getSharingMode());
@@ -205,6 +201,7 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {

    // Save device format so we can do format conversion and volume scaling together.
    setDeviceFormat(configurationOutput.getFormat());
    setDeviceSamplesPerFrame(configurationOutput.getSamplesPerFrame());

    setHardwareSamplesPerFrame(configurationOutput.getHardwareSamplesPerFrame());
    setHardwareSampleRate(configurationOutput.getHardwareSampleRate());
+0 −6
Original line number Diff line number Diff line
@@ -138,8 +138,6 @@ protected:
    // Calculate timeout for an operation involving framesPerOperation.
    int64_t calculateReasonableTimeout(int32_t framesPerOperation);

    int32_t getDeviceChannelCount() const { return mDeviceChannelCount; }

    /**
     * @return true if running in audio service, versus in app process
     */
@@ -213,10 +211,6 @@ private:

    int64_t                  mServiceLatencyNanos = 0;

    // Sometimes the hardware is operating with a different channel count from the app.
    // Then we require conversion in AAudio.
    int32_t                  mDeviceChannelCount = 0;

    int32_t                  mBufferSizeInFrames = 0; // local threshold to control latency
    int32_t                  mDeviceBufferSizeInFrames = 0;
    int32_t                  mBufferCapacityInFrames = 0;
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ aaudio_result_t AudioStreamInternalCapture::open(const AudioStreamBuilder &build
    aaudio_result_t result = AudioStreamInternal::open(builder);
    if (result == AAUDIO_OK) {
        result = mFlowGraph.configure(getDeviceFormat(),
                             getDeviceChannelCount(),
                             getDeviceSamplesPerFrame(),
                             getDeviceSampleRate(),
                             getFormat(),
                             getSamplesPerFrame(),
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ aaudio_result_t AudioStreamInternalPlay::open(const AudioStreamBuilder &builder)
                             getSamplesPerFrame(),
                             getSampleRate(),
                             getDeviceFormat(),
                             getDeviceChannelCount(),
                             getDeviceSamplesPerFrame(),
                             getDeviceSampleRate(),
                             getRequireMonoBlend(),
                             useVolumeRamps,
Loading