← Back to Pull requests

feat(player): filter hls ads by pts continuity and align timestamps #3471

Closed
unknown closed this pull request without merging on Oct 01, 2026 13:36 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 12:37 UTC
Author

概述

在线源的插播广告改为按时间戳连续性识别并移除,默认开启;桌面端播放含广告的 HLS 流时,进度条不再跳变。

根因

采集站用 #EXT-X-DISCONTINUITY 把独立转码的广告拼进播放列表。广告的 PTS 从 1.47 秒附近重新起算,正片各段则首尾相接。

  • 原过滤按组的时长和分片数猜测,正片被切碎时会删掉正片残片、放过广告。

  • libavformat 不按 discontinuity 重映射 PTS,mpv 的进度一进广告就跳走。
  • 改动

  • 探测每组首片的 PTS,把首尾相接的组串成链,取最长的一条作为正片。链外的组只有从时间轴起点开始、或紧接前一段广告时才删除。首组、超过 60 秒的一段、加密播放列表、探测失败的组一律保留。原有结构规则移除。

  • 探测每组只读 2KB,32 路并发,只在开启过滤且含拼接点时进行。

  • 代理转发时把分片的 PTS、DTS、PCR 平移到播放列表时间轴,改写等长。

  • 设置换用默认开启的 enableHlsAdFiltering,iOS 也显示开关。
  • 验证

    独立标注的 48 个播放列表、3038 个组上,原实现误删正片 6 处、漏删 4 处;本实现均为 0。

    在真实样本上重放过滤,删除结果经人工核对:

    | 样本 | 播放列表 | 删除 | 误删 |
    |---|---|---|---|
    | 采集站,4 条资源站线路 | 113 | 168 组 | 0 |
    | 官方数据源,12 个站点 | 39 | 31 组 | 0 |

    正片相对链的偏差最大 5 毫秒,广告最小 284 秒。287 组的播放列表在每请求新建连接时探测耗时 7.7 秒(32 路),应用内复用连接的耗时尚未实测。

    HLS 相关测试本地通过。当前 main 的 SubjectCollectionRepositoryInvalidateTest 因 446e34ed5 新增参数而编译失败,本地验证时临时补上,未包含在本 PR 中。

    Diff: 107 lines (+80 / -27) across 1 files Reviewer: Him188 Review duration: 11578m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.31) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 107 lines diff across 1 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.289
    Diff Size diff_size
    0.280
    Real PR Conversation Timeline
    1 comments
    "Review active on #3471"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 31% (LOW) · Higher = larger blast radius
    31%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 12.2% · Safe to merge
    12.2%