Skip to content
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

Add: tests for pipeline mode API parameters check #1048

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/src/st2110/experimental/st40_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,12 @@ st40p_tx_handle st40p_tx_create(mtl_handle mt, struct st40p_tx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (MT_HANDLE_MAIN != impl->type) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/st2110/pipeline/st20_pipeline_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,12 @@ st20p_rx_handle st20p_rx_create(mtl_handle mt, struct st20p_rx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (impl->type != MT_HANDLE_MAIN) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/st2110/pipeline/st20_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,12 @@ st20p_tx_handle st20p_tx_create(mtl_handle mt, struct st20p_tx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (impl->type != MT_HANDLE_MAIN) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/st2110/pipeline/st22_pipeline_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,12 @@ st22p_rx_handle st22p_rx_create(mtl_handle mt, struct st22p_rx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (impl->type != MT_HANDLE_MAIN) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/st2110/pipeline/st22_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,12 @@ st22p_tx_handle st22p_tx_create(mtl_handle mt, struct st22p_tx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (impl->type != MT_HANDLE_MAIN) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/st2110/pipeline/st30_pipeline_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ st30p_rx_handle st30p_rx_create(mtl_handle mt, struct st30p_rx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (impl->type != MT_HANDLE_MAIN) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/st2110/pipeline/st30_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ st30p_tx_handle st30p_tx_create(mtl_handle mt, struct st30p_tx_ops* ops) {

notice("%s, start for %s\n", __func__, mt_string_safe(ops->name));

/* validate the input parameters */
// if (!mt || !ops) {
// err("%s(%d), NULL input parameters \n", __func__, idx);
// return NULL;
// }

if (impl->type != MT_HANDLE_MAIN) {
err("%s, invalid type %d\n", __func__, impl->type);
return NULL;
Expand Down
18 changes: 18 additions & 0 deletions tests/unittest/st20p_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,15 @@ static void st20p_rx_digest_test(enum st_fps fps[], int width[], int height[],
st_frame_size(tx_fmt[i], width[i], height[i], ops_tx.interlaced) +
para->line_padding_size * height[i] * planes;

tx_handle[i] = st20p_tx_create(NULL, &ops_tx);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st20p_tx_create(st, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st20p_tx_create(NULL, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st20p_tx_create(st, &ops_tx);
ASSERT_TRUE(tx_handle[i] != NULL);

Expand Down Expand Up @@ -1038,6 +1047,15 @@ static void st20p_rx_digest_test(enum st_fps fps[], int width[], int height[],
ops_rx.rtcp.sim_loss_rate = 0.1;
}

rx_handle[i] = st20p_rx_create(NULL, &ops_rx);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st20p_rx_create(st, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st20p_rx_create(NULL, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st20p_rx_create(st, &ops_rx);
ASSERT_TRUE(rx_handle[i] != NULL);

Expand Down
18 changes: 18 additions & 0 deletions tests/unittest/st22p_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,15 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[],
ops_tx.codestream_size = test_ctx_tx[i]->frame_size / compress_ratio[i];
}

tx_handle[i] = st22p_tx_create(NULL, &ops_tx);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st22p_tx_create(st, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st22p_tx_create(NULL, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st22p_tx_create(st, &ops_tx);
ASSERT_TRUE(tx_handle[i] != NULL);

Expand Down Expand Up @@ -1114,6 +1123,15 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[],
test_ctx_rx[i]->frame_size = st_frame_size(ops_rx.output_fmt, ops_rx.width,
ops_rx.height, ops_rx.interlaced);

rx_handle[i] = st22p_rx_create(NULL, &ops_rx);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st22p_rx_create(st, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st22p_rx_create(NULL, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st22p_rx_create(st, &ops_rx);
ASSERT_TRUE(rx_handle[i] != NULL);

Expand Down
18 changes: 18 additions & 0 deletions tests/unittest/st30p_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ static void st30p_rx_digest_test(enum st30_fmt fmt[], uint16_t channel[],

test_ctx_tx[i]->frame_size = ops_tx.framebuff_size;

tx_handle[i] = st30p_tx_create(NULL, &ops_tx);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st30p_tx_create(st, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st30p_tx_create(NULL, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

tx_handle[i] = st30p_tx_create(st, &ops_tx);
ASSERT_TRUE(tx_handle[i] != NULL);

Expand Down Expand Up @@ -429,6 +438,15 @@ static void st30p_rx_digest_test(enum st30_fmt fmt[], uint16_t channel[],
else
ops_rx.notify_frame_available = test_st30p_rx_frame_available;

rx_handle[i] = st30p_rx_create(NULL, &ops_rx);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st30p_rx_create(st, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st30p_rx_create(NULL, NULL);
ASSERT_TRUE(tx_handle[i] == NULL);

rx_handle[i] = st30p_rx_create(st, &ops_rx);
ASSERT_TRUE(rx_handle[i] != NULL);

Expand Down
Loading