Skip to content

EP-08 Design app with thread-safe frame record accumulation #11

Description

@Adityasakare

Implement FrameRecord and ProfilerData structures which use std::mutex for the frame vector and std::atomic for counters. GStreamer pad probes run on streaming threads.

Why

Without thread safety, concurrent probe callbacks corrupt the frame vector. std::atomic for counters avoids lock overhead on hot path.

Acceptance criteria

  • FrameRecord: frame_number, enter_ns, exit_ns, latency_ms, encoded_bytes, is_keyframe
  • ResourceSnapshot: timestamp_ns, cpu_percent, rss_kb
  • ProfilerData: vector with std::mutex
  • std::atomic frame_count
  • add_frame() method thread-safe
  • No data races (run with -fsanitize=thread)

Resources

  • std::atomic cppreference
  • GST_BUFFER_FLAG_DELTA_UNIT

Activity

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

Metadata

Metadata

Assignees

Labels

5sp~3-4 hrsfeatureNew functionality

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions