| 300 | } |
| 301 | |
| 302 | void StreamingVideoDecoder::decodeSampled(Timestamp interval_ns, const std::function<bool(const DecodedFrame&)>& sink) { |
| 303 | if (store_ == nullptr || interval_ns <= 0 || store_->entryCount(topic_) == 0) { |
| 304 | return; |
| 305 | } |
| 306 | // Adaptive dispatch: when the source already carries keyframes at least as dense |
| 307 | // as the requested cadence, decode only ~1 keyframe per interval (same cadence, |
| 308 | // near-instant). Otherwise fall back to the forward pass. |
| 309 | if (sampledUsesKeyframeOnly(interval_ns)) { |
| 310 | decodeSampledKeyframes(interval_ns, sink); |
| 311 | } else { |
| 312 | decodeSampledForward(interval_ns, sink); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | void StreamingVideoDecoder::decodeSampledKeyframes( |
| 317 | Timestamp interval_ns, const std::function<bool(const DecodedFrame&)>& sink) { |