Skip to content

[Test] Read back the framework before tensor_filter is configured - #699

Open
myungjoo wants to merge 2 commits into
nnstreamer:mainfrom
myungjoo:i5240-get-property-string
Open

myungjoo wants to merge 2 commits into
nnstreamer:mainfrom
myungjoo:i5240-get-property-string

Conversation

@myungjoo

@myungjoo myungjoo commented Nov 27, 2026 •

Copy link
Copy Markdown
Member
  • Topic: nnstreamer_capi_element.get_property_string_01_p fails on Tizen against nnstreamer main. It reads back "tensorflow-lite" after setting framework to "nnfw" ([CI] Daily GBS and Docker workflows on main fail every day: 32-bit sparse test, blocked coverage push, Docker openvino nnstreamer#5240). Since nnstreamer/nnstreamer@9b1258e4 ([Security] Security audit of the NNStreamer core (gst/): tracking checklist nnstreamer#4960 C2), a tensor_filter that has an open framework and negotiated input caps keeps its framework, with only a warning. appsrc negotiates the caps of its caps property in its streaming thread in PAUSED, before any buffer, so the filter is already configured when the test switches. The setter still returns ML_ERROR_NONE.
  • Change: the test's appsrc no longer has caps, so the filter is never configured on any GStreamer version and the read-back checks the string property round trip again (commit 1). The eight ml_pipeline_element_set_property_*() functions get an @remarks saying that an element may ignore a value in its current state while the call still returns ML_ERROR_NONE, and that the matching getter usually tells whether the value was applied, except for properties that report the stored value, such as the model of a tensor_filter that does not reload models (commit 2, documentation only).
  • Result: Tizen GBS x86_64 (GStreamer 1.24.11) against nnstreamer main 363f3127 passes 240/240 with this branch (fork run; it built d7a71a1, which differs from the head only by the clang-format re-wrap of one call and the wording of the header remarks). With api main d0a687d, the same setup fails exactly this test (239/240, reads back "tensorflow-lite"; fork run). No library code changes.

The nnstreamer side documents the same rule in the tensor_filter README: nnstreamer/nnstreamer#5314. The guard itself stays as it is.

Same pattern elsewhere: set_property_string_01_p sets framework on the same pipeline but never reads it back, so it passes either way and is left as is. Every other set/get test uses state-independent properties (videotestsrc, videoscale, udpsrc, input-selector, tensor_demux).

No new test: this fixes an existing test, and the header change is documentation. The relayed review suggested a test that pins the new remark: push a buffer, then expect the switch to be ignored. It is left out. This repository's CI builds against the nnstreamer packages of the Tizen repositories, and such a test would fail until those packages include nnstreamer/nnstreamer@9b1258e4. It would also test nnstreamer's behavior rather than this API's. nnstreamer covers it in its own tests (unittest_filter_event.cc, unittest_filter_custom.cc).

Notes for agents
  • Bisect on Tizen GBS x86_64 (fork-only workflow i5240_mlapi_diag.yml on myungjoo/nnstreamer; the test's EXPECT_TRUE (g_str_equal ...) is rewritten to EXPECT_STREQ so that the value is printed). Results: 9c651dcf (parent of 9b1258e4) 240/240; 9b1258e4, 637ca3a8, 846c13ba and 363f3127 fail with Which is: "tensorflow-lite". The nnfw V1 conversion is not the cause.
  • No GStreamer-version contrast: 1.20.3 gst_app_src_create() also negotiates queued caps before it waits for a buffer.
  • Guard: _gtfc_setprop_FRAMEWORK refuses when watchdog_h != NULL || (fw_opened && configured && !is_suspended && in_config.rate_d > 0).
  • This repository's own GBS CI builds against the nnstreamer in the Tizen repositories, so it only shows the failure once those packages include 9b1258e4.

🤖 Generated with Claude Code

@myungjoo

Copy link
Copy Markdown
Member Author

Relayed review: this comment was written by another AI agent (an automated code-review pass), not by a human reviewer. It is posted on behalf of the maintainer for the record.

Scope reviewed: the two commits of this PR, against the current c/src/ml-api-inference-pipeline.c, the test file, and _gtfc_setprop_FRAMEWORK in nnstreamer main (gst/nnstreamer/tensor_filter/tensor_filter_common.c).

Verified

  • Topic is addressed. get_property_string_01_p is the only test that sets framework on a pipeline and then reads it back with appsrc caps (set_property_string_01_p at ~L4678 sets it but does not read it back, so it passes either way). Dropping the caps removes the only trigger of the guard.
  • Guard behavior matches the PR text. _gtfc_setprop_FRAMEWORK returns 0 with only an ml_logw when watchdog_h != NULL || (fw_opened && configured && !is_suspended && in_config.rate_d > 0). in_config.rate_d only becomes > 0 from negotiated input caps, so an appsrc without caps never sets it on any GStreamer version. The test is therefore deterministic on 1.20 and 1.24 (nothing is pushed, so the filter is never configured). In the no-caps case the guard does not fire and the switch to nnfw takes the normal close-and-reopen path, so the test still checks the string-property round trip it was written for.
  • The @remarks is true. ml_pipeline_element_set_property() ends in g_object_set(...) (void) followed by handle_exit(), so ret stays ML_ERROR_NONE; the guard's refusal is invisible to the caller. All eight setters funnel through this one function, so the statement is accurate for all of them.
  • No other place needs the same change. In this repo the only framework set/get pair is get_property_string_01_p; the other set/get tests use state-independent properties (videoscale method, udpsrc, tensorpick, etc.). Only c/include/nnstreamer.h documents these setters (no Java/.NET/C++ copies of the doc in this repo). No library code is touched, so there is no regression risk for other modules.
  • Size and scope are proportionate (10 added, 1 removed lines; one test, one header, doc only).

Findings

  1. Low (non-blocking), no test pins the documented behavior. The new @remarks promises "returns ML_ERROR_NONE, value is not applied, read it back". Nothing in this repo checks that, and the old test is the only thing that noticed the nnstreamer change. If nnstreamer later changes the guard (e.g. returns an error, or starts allowing the switch), the API docs silently become wrong or the behavior changes unnoticed. A dedicated case would need the filter to be configured deterministically on all GStreamer versions, i.e. push one buffer through appsrc (or wait for caps) before the switch, then assert ML_ERROR_NONE and that the read-back is still tensorflow-lite. A caps-only variant would be version dependent (1.20 vs 1.24), which is exactly the flakiness this PR removes, so I would not add that. Reasonable as a follow-up; the PR body already states the reason for adding no test.
  2. Nit (header style), long and repeated text. The same two-sentence remark with a tensor_filter-specific example is repeated eight times on the generic setter docs. It follows the existing Tizen style (separate @remarks lines, #ML_ERROR_NONE, as in the existing double/enum entries), so it is acceptable. If you want it shorter, "The element may ignore the new value depending on its state (e.g., the framework of a running tensor_filter). This function still returns #ML_ERROR_NONE; use ml_pipeline_element_get_property_*() to check the applied value." would do. Note the remark says "already been configured for its input stream"; the nnstreamer README (nnstreamer#5314) is the place that defines this, so keep the two wordings consistent.
  3. Info, CI coverage. This repo's GBS CI builds against the nnstreamer packages in the Tizen repositories, so the PR cannot show the failure or the fix until those include 9b1258e4. The PR body says the Tizen GBS x86_64 run is VERIFY_PENDING; please confirm 240/240 there before removing DRAFT / DO NOT MERGE. This is a limit of the existing CI and not something this PR needs to fix.

Verdict

Approve in substance (no blocking issues): the test change is correct and deterministic, the remark is accurate, and nothing else needs the same edit. Only pending items are the VERIFY_PENDING Tizen run and the optional follow-up test in finding 1.

@myungjoo
myungjoo force-pushed the i5240-get-property-string branch from d7a71a1 to d1b2fec Compare November 27, 2026 09:16
@myungjoo
myungjoo marked this pull request as ready for review November 27, 2026 09:55
myungjoo and others added 2 commits December 3, 2026 15:24
get_property_string_01_p sets "framework" to "nnfw" on a constructed
(PAUSED) pipeline and expects to read "nnfw" back. Since
nnstreamer/nnstreamer@9b1258e4 (nnstreamer/nnstreamer#4960 C2), a
tensor_filter that has an open framework and a configured input
stream with a non-zero framerate denominator keeps its framework and
only logs a warning; set_property still succeeds.

appsrc negotiates the caps of its "caps" property in its streaming
thread in PAUSED, before any buffer, so the filter is configured by
the time the test switches the framework and "tensorflow-lite" is
read back (seen on Tizen once its nnstreamer includes 9b1258e4).

Drop the caps from the appsrc of this test so the filter is never
configured and the read-back checks the string property round trip
it was written for.

Refs nnstreamer/nnstreamer#5240

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ml_pipeline_element_set_property_*() returns ML_ERROR_NONE once
g_object_set() is called, but an element may keep its old value in
its current state; for example, tensor_filter keeps its framework
after its input stream is configured (nnstreamer/nnstreamer#4960 C2).
Say so in @remarks of the eight setters and point to the matching
getter, noting that a getter may report the stored value instead of
the one in use (the model of a tensor_filter that does not reload
models).

Documentation only; no behavior change.

Refs nnstreamer/nnstreamer#5240

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@myungjoo
myungjoo force-pushed the i5240-get-property-string branch from d1b2fec to 548346f Compare December 3, 2026 06:24
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.

1 participant