Skip to content

Commit 96ad409

Browse files
poneciak57Copilotmaciejmakowski2003
authored
feat: graph refactor chapter I (#939)
* feat: prepared all files * feat: audio graph impl * feat: fat function impl with tests * fix: fixed tests * feat: declared api and implemented helpers for testing * feat: implemented DSU * feat: implemented graph abstraction * chore: formatting * chore: removed dsu impl * feat: changed host graph to use result * feat: implemented graph wrapper * feat: implemented ptr disposer * feat: implemented proper memory management for audio graph * fix: fixed issue with ghost nodes in hostgraph * feat: added templating to graphs * feat: implemented solid separate standalone mock * feat: fixed audio thread allocation issue * feat: added disposer back to events * feat: added separate script for running graph tests * fix: fixed tests issue * feat: updated CI to run graph tests only if graph related files have changed * feat: added dockerfile for easier asan on macos * fix: fixed issue with fat function move eq operator * Update .github/workflows/graph-tests.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/react-native-audio-api/common/cpp/test/src/graph/GraphCycleDebugTest.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/react-native-audio-api/common/cpp/test/src/graph/GraphCycleDebugTest.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: fixed memory leak and comments from copilot * fix: fixed fat function to work properly with mutable closures * docs: graph overall docs with essential info * fix: requested changes * fix: fixed bug with memory allocation on audio thread and doc comments * ci: formatting * ci: formatting * fix: remove redundant typename keyword --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: maciejmakowski2003 <maciejmakowski2003@users.noreply.github.com>
1 parent 2787143 commit 96ad409

32 files changed

Lines changed: 4619 additions & 21 deletions

.github/workflows/graph-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Graph Tests
2+
on:
3+
pull_request:
4+
paths:
5+
- 'packages/react-native-audio-api/common/cpp/audioapi/core/utils/graph/**'
6+
- 'packages/react-native-audio-api/common/cpp/test/src/graph/**'
7+
8+
jobs:
9+
graph-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: ./.github/actions/setup
14+
- run: yarn test:graph

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ jobs:
1717

1818
- name: Run tests
1919
run: yarn test
20+

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"clean": "del-cli packages/**/android/build apps/**/android/build apps/**/android/app/build apps/**/ios/build packages/**/lib node_modules apps/**/node_modules packages/**/node_modules",
1818
"typecheck": "yarn workspaces foreach -A -p run typecheck",
1919
"test": "bash packages/react-native-audio-api/common/cpp/test/RunTests.sh",
20+
"test:graph": "bash packages/react-native-audio-api/common/cpp/test/RunTestsGraph.sh",
21+
"test:graph:docker": "bash packages/react-native-audio-api/common/cpp/test/RunTestsGraphDocker.sh",
2022
"check-audio-enum-sync": "bash packages/react-native-audio-api/scripts/check-audio-events-sync.sh"
2123
},
2224
"devDependencies": {

packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ AudioNode::~AudioNode() {
2929
}
3030
}
3131

32+
bool AudioNode::canBeDestructed() const {
33+
return true;
34+
}
35+
3236
size_t AudioNode::getChannelCount() const {
3337
return channelCount_;
3438
}

packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class AudioNode : public std::enable_shared_from_this<AudioNode> {
6262
return false;
6363
}
6464

65+
virtual bool canBeDestructed() const;
66+
6567
protected:
6668
friend class AudioGraphManager;
6769
friend class AudioDestinationNode;

0 commit comments

Comments
 (0)