Skip to content

OboeTester: Test multiple input and output streams#2375

Open
robertwu1 wants to merge 2 commits intomainfrom
robertwu/oboetestermultiplestreams
Open

OboeTester: Test multiple input and output streams#2375
robertwu1 wants to merge 2 commits intomainfrom
robertwu/oboetestermultiplestreams

Conversation

@robertwu1
Copy link
Copy Markdown
Collaborator

Fixes #1845

This PR adds a new activity with 2 input streams and 2 output streams for testing

@robertwu1 robertwu1 requested a review from flamme April 20, 2026 21:58
import android.widget.Button;
import java.io.IOException;

public class TestMultiStreamActivity extends TestAudioActivity {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, MultiStreams

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Multi-Stream (2 Out, 2 In)"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to allow selecting numbers of streams? And is it possible to have the different numbers of output and input stream.


if (audioStream->getDirection() == oboe::Direction::Output) {
int channelCount = audioStream->getChannelCount();
float phaseIncrement = 440.0f * M_PI * 2 / (float)audioStream->getSampleRate();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: we don't have any common code of generating sine wave?

for (int i = 0; i < 8; i++) mPeakLevels[i] = 0.0;
}

oboe::DataCallbackResult onAudioReady(oboe::AudioStream *audioStream, void *audioData, int32_t numFrames) override {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is always not preferred to have tons of logic in header file.


oboe::DataCallbackResult onAudioReady(oboe::AudioStream *audioStream, void *audioData, int32_t numFrames) override {
int channelCount = audioStream->getChannelCount();
if (channelCount > 8) channelCount = 8;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why limit the count to 8? If it is limited, it needs to be aware of from the UI.

double mPeakLevels[8];
};

ActivityTestMultiStream() = default;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed.


ActivityTestMultiStream() = default;

virtual ~ActivityTestMultiStream() = default;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

protected void findAudioCommon() {
// Initialize this so TestAudioActivity doesn't crash in setConfigViewsEnabled
mStreamContexts = new java.util.ArrayList<>();
// Do not call super.findAudioCommon() so TestAudioActivity doesn't hijack the first stream's buttons!
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this cause problem given mStreamSniffer is initialized in findAudioCommon and there are some places in TestAudioActivity use the value without checking if it is null or not.

@Override
protected void resetConfiguration() {
super.resetConfiguration();
mOut1.tester.reset();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all of these streams can be leaked if closed button is not clicked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OboeTester: add a test for two output streams

2 participants