-
Notifications
You must be signed in to change notification settings - Fork 21
Val: Un-mocking the TestApp with actual API-based implementation #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zLukas
merged 68 commits into
OpenVisualCloud:main
from
zLukas:zlukas/connect_json_api_to_test_app
Jan 27, 2025
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
edbf9cb
Rewrite test app (#284)
zLukas 2cb4d11
[VAL] Initial push for pytest engine (#273)
MateuszGrabuszynski 45b9de4
minor renaming
zLukas 4a0ec7b
cmake improvement
zLukas aa05a0e
sdk succesfully linked to TestApp
zLukas afb83d8
minor updates
zLukas 6301310
json api SDK linket to test App
zLukas 69e9ea8
TxApp file serializing implemented
zLukas b450ec1
minor fixes
zLukas 9832410
receiver side implemented, ready for testing
zLukas 797daf5
add missing step to tx send_video function
zLukas 1e7322b
clear typo
zLukas d9f5328
txApp can send multiple frames
zLukas 1fdeea6
update rxApp to append the file
zLukas 6cafd57
Merge branch 'main' into zlukas/connect_json_api_to_test_app
zLukas 7e0b5e6
Pair programming session output
MateuszGrabuszynski 6d8af6e
rx app append funct updated
zLukas 1ba9264
Squashed: alignment from Friday and Monday
MateuszGrabuszynski e931a83
Adding file handling
MateuszGrabuszynski 608a37d
minor cleanup
zLukas c0cc3d4
check for root access
zLukas bf6778a
debug data transfer succesfull
MateuszGrabuszynski 0d01ad6
simplify send video function, update file writing in RX app
MateuszGrabuszynski f03178e
dev test cleanup, rxApp logic moved to mcm.c file
zLukas 95ec25a
add logging info
zLukas 1c26a50
remove unnecessary function cals
zLukas 8986ca3
Merge branch 'main' into zlukas/connect_json_api_to_test_app
zLukas e7faf58
run clang-format on code files
zLukas e62981a
fix: typo succesfully -> successfully
MateuszGrabuszynski f758736
Changing usage message for path to file
MateuszGrabuszynski d31b258
Exiting instead of returns; avoiding segfault by exiting more
MateuszGrabuszynski 655c3c9
Adding a space before BSD_LIB variable
MateuszGrabuszynski 27bd182
Switched all printf() messages to include [RX]/[TX] at the beginning …
MateuszGrabuszynski baf1f78
Removed 2 includes of mcm_dp.h
MateuszGrabuszynski 3379d28
Removing unnecessary comments
MateuszGrabuszynski bdf6c26
Changing mcm_send_video_frame to mcm_send_video_frames, frame_file to…
MateuszGrabuszynski e780922
Adding missing exit()
MateuszGrabuszynski 4ea8a4e
Adding a todo message for pacing implementation
MateuszGrabuszynski 210f4ae
remove unneccessery files
zLukas f4227c4
run-clang formatter
zLukas 151287e
linter fix
zLukas e1d9658
exclude C test app from CPP lint
zLukas a9672f5
update cpplint.cfg
zLukas 40c9cd5
update cpplint.cfg
zLukas 1a059ea
run clang-format once again
zLukas 1693313
Merge branch 'main' into zlukas/connect_json_api_to_test_app
MateuszGrabuszynski 03a4526
docs: Improving README's structure, adding json examples for client a…
MateuszGrabuszynski 218cbed
fix header guards in header files
zLukas f62d499
fix comment style
zLukas af2ab53
minor refactor
zLukas 04b75d1
minor refactor
zLukas 3f91324
proper functions exit, deallocating memory in main files
zLukas 9b30343
add goto statement, update syntax
zLukas 352fe40
readme update
zLukas 901eb0c
Update input.h
zLukas 2d40dac
Update client_example.json
zLukas 637c9a1
Update mcm.h
zLukas 39e394f
Update connection_example.json
zLukas 18d7223
run clang format
zLukas e72c8b9
Merge remote-tracking branch 'upstream/main' into zlukas/connect_json…
zLukas 8859c6c
remove const from json parsing return type, remove casting in derefer…
zLukas 423aa2c
simplify is_root function, add break; to all errors in receive loop
zLukas 4ef5b2a
minor refactor
zLukas 0c772a1
removed unecessary returns
zLukas 9422588
update license info
zLukas 6f74540
style changes
zLukas ba13e5f
run clang-format
zLukas c0926f5
Merge branch 'main' into zlukas/connect_json_api_to_test_app
zLukas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| set noparent | ||
| exclude_files=tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025 Intel Corporation | ||
| * | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| */ | ||
|
|
||
| #ifndef _INPUT_H_ | ||
| #define _INPUT_H_ | ||
|
|
||
| const char* parse_json_to_string(const char* file_name); | ||
| int is_mock_enabled(); | ||
|
|
||
| char *parse_json_to_string(const char *file_name); | ||
|
|
||
| #endif /* _INPUT_H_*/ | ||
| #endif /* _INPUT_H_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,21 @@ | ||
|
|
||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025 Intel Corporation | ||
| * | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| */ | ||
|
|
||
| #ifndef _MCM_H_ | ||
| #define _MCM_H_ | ||
| #include "mcm_mock.h" | ||
|
|
||
| #define DUMMY_LEN 1 | ||
| typedef struct mcm_ts{ | ||
| MeshConnection *connection; | ||
| MeshClient *client; | ||
| }mcm_ts; | ||
|
|
||
| #include <stdio.h> | ||
| #include "mesh_dp.h" | ||
|
|
||
| int mcm_init_client(mcm_ts* mcm, const char* cfg); | ||
| int mcm_create_tx_connection(mcm_ts* mcm, const char* cfg); | ||
| int mcm_create_rx_connection(mcm_ts* mcm, const char* cfg); | ||
| int mcm_send_video_frame(mcm_ts* mcm, const char* frame, int frame_len); | ||
| int mcm_receive_video_frames(mcm_ts* mcm); | ||
| int file_to_buffer(FILE* fp, MeshBuffer* buf, int frame_size); | ||
| int mcm_init_client(MeshConnection **connection, MeshClient *client, const char *cfg); | ||
| int mcm_create_tx_connection(MeshConnection *connection, MeshClient *client, const char *cfg); | ||
| int mcm_create_rx_connection(MeshConnection *connection, MeshClient *client, const char *cfg); | ||
| int mcm_send_video_frames(MeshConnection *connection, const char *filename); | ||
| void read_data_in_loop(MeshConnection *connection, const char *filename); | ||
| int is_root(); | ||
|
|
||
| #endif /* _MCM_H_*/ | ||
| #endif /* _MCM_H_ */ |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,46 @@ | ||
| # TestApp | ||
|
|
||
| Application for utilizing MCM api, | ||
| Application for utilizing Media Communications Mesh SDK API. | ||
|
|
||
| *Disclaimer* | ||
| TX/RXapp is prepared for new api (/docs/sdk-json-proposal) that is not implemented yet, so, so far it works with simple mocks, that move a file from TxApp to RxApp. | ||
| ## Prerequisities | ||
| before building this code following libreries need to be build and installed on host system: | ||
| * [grpc](grpcMedia-Communications-Mesh/sdk/README.md) | ||
| * [memif](Media-Communications-Mesh/sdk/3rdparty/libmemif/docs/buildinstructions_doc.rst) | ||
|
|
||
| test apps use them as shared libraries during linking stage, without them, compilation will fail. | ||
|
|
||
| ## Usage | ||
| 1. Create directory: | ||
| ```shell | ||
| mkdir /tmp/MCM_MOCK | ||
| ``` | ||
| 1. Build binaries: | ||
| ```shell | ||
| mkdir build && cd build | ||
| cmake .. | ||
| make | ||
| touch client.json | ||
| touch connection.json | ||
| ``` | ||
| ```shell | ||
| mkdir build && cd build | ||
| cmake .. | ||
| make | ||
| ``` | ||
|
|
||
| 1. Run RxApp: | ||
| ```shell | ||
| $ ./RxApp | ||
| launching RX App | ||
| RX App PID: 956656 | ||
| reading client configuration... | ||
| reading connection configuration... | ||
| waiting for frames.. | ||
| 2. Prepare client and conneciton files for sender (TxApp) and receiver (RxApp) | ||
| ```shell | ||
| touch client_tx.json | ||
| touch connection_tx.json | ||
| touch client_rx.json | ||
| touch connection_rx.json | ||
| ``` | ||
| > Note: The names of the files can differ from the ones presented above, but they must be reflected in the commands as in the following points. | ||
| Exemplary contents of those files can be found in [`client_example.json`](client_example.json) and [`connection_example.json`](connection_example.json). For more, check [appropriate documentation](../../../docs/sdk-json-proposal/SDK_API_WORKFLOW.md). | ||
|
|
||
| ``` | ||
| 3. Run RxApp: | ||
| ```shell | ||
| ./RxApp <client_cfg.json> <connection_cfg.json> <path_to_output_file> | ||
| ``` | ||
| For example: | ||
| ```shell | ||
| ./RxApp client_rx.json connection_rx.json output_video.yuv | ||
| ``` | ||
|
|
||
| 1. Run TxApp: | ||
| ```shell | ||
| ./TxApp <abs path to file to transmit> <RX App PID> | ||
| ``` | ||
| 4. Run TxApp: | ||
| ```shell | ||
| ./TxApp <client_cfg.json> <connection_cfg.json> <path_to_input_file> | ||
| ``` | ||
| For example: | ||
| ```shell | ||
| ./RxApp client_tx.json connection_tx.json input_video.yuv | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "apiVersion": "v1", | ||
| "apiConnectionString": "Server=127.0.0.1; Port=8002", | ||
| "apiDefaultTimeoutMicroseconds": 100000, | ||
| "maxMediaConnections": 32 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "connection": { | ||
| "multipointGroup": { | ||
| "urn": "ipv4:192.168.123.123" | ||
| } | ||
| }, | ||
| "payload": { | ||
| "video": { | ||
| "width": 1920, | ||
| "height": 1080, | ||
| "fps": 60.0, | ||
| "pixelFormat": "yuv422p10rfc4175" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,59 @@ | ||
| #include <stdio.h> | ||
| #include <unistd.h> | ||
| #include <stdlib.h> | ||
| #include "Inc/input.h" | ||
| #include "Inc/mcm.h" | ||
| #include <unistd.h> | ||
|
|
||
| const char* client_cfg; | ||
| const char* conn_cfg; | ||
|
|
||
| int main(int argc, char* argv[]){ | ||
|
|
||
| printf("launching RX App \n"); | ||
| printf("RX App PID: %d\n", getpid()); | ||
| printf("reading client configuration... \n"); | ||
| client_cfg = parse_json_to_string("client.json"); | ||
| printf("reading connection configuration... \n"); | ||
| conn_cfg = parse_json_to_string("connection.json"); | ||
| mcm_ts mcm; | ||
| mcm_init_client(&mcm, client_cfg); | ||
| mcm_create_rx_connection(&mcm, conn_cfg); | ||
| printf("waiting for frames... \n"); | ||
| while(1){ | ||
| // mcm_create_rx_connection(&mcm, conn_cfg); | ||
| // mcm_receive_video_frames(&mcm); | ||
| } | ||
| return 0; | ||
| } | ||
| char *client_cfg; | ||
| char *conn_cfg; | ||
|
|
||
| int main(int argc, char *argv[]) { | ||
| if (!is_root()) { | ||
| fprintf(stderr, "This program must be run as root. Exiting.\n"); | ||
| exit(EXIT_FAILURE); | ||
| } | ||
| if (argc != 4) { | ||
| fprintf(stderr, "Usage: %s <client_cfg.json> <connection_cfg.json> <path_to_output_file>\n", | ||
| argv[0]); | ||
| exit(EXIT_FAILURE); | ||
| } | ||
|
|
||
| char *client_cfg_file = argv[1]; | ||
| char *conn_cfg_file = argv[2]; | ||
| char *out_filename = argv[3]; | ||
|
|
||
| MeshConnection *connection = NULL; | ||
| MeshClient *client = NULL; | ||
|
|
||
| printf("[RX] Launching RX App \n"); | ||
| printf("[RX] Reading client configuration... \n"); | ||
| client_cfg = parse_json_to_string(client_cfg_file); | ||
zLukas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| printf("[RX] Reading connection configuration... \n"); | ||
| conn_cfg = parse_json_to_string(conn_cfg_file); | ||
zLukas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /* Initialize mcm client */ | ||
| int err = mesh_create_client_json(&client, client_cfg); | ||
| if (err) { | ||
| printf("[RX] Failed to create mesh client: %s (%d)\n", mesh_err2str(err), err); | ||
| goto safe_exit; | ||
| } | ||
|
|
||
| /* Create mesh connection */ | ||
| err = mesh_create_rx_connection(client, &connection, conn_cfg); | ||
| if (err) { | ||
| printf("[RX] Failed to create connection: %s (%d)\n", mesh_err2str(err), err); | ||
| mesh_delete_client(&client); | ||
| goto safe_exit; | ||
| } | ||
| printf("[RX] Waiting for frames... \n"); | ||
| read_data_in_loop(connection, out_filename); | ||
| printf("[RX] Shuting down connection and client\n"); | ||
| mesh_delete_connection(&connection); | ||
| mesh_delete_client(&client); | ||
| printf("[RX] Shutdown completed exiting\n"); | ||
|
|
||
| safe_exit: | ||
| free(client_cfg); | ||
| free(conn_cfg); | ||
| return err; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.