Backend Development 7 min read

Root Cause Analysis of Video Artifacts Caused by a P2P Box Upgrade

A recent P2P box SDK upgrade introduced video screen‑tearing and gray‑screen issues for app users, which were traced to a faulty C++ vector initialization that caused multiple data buffers to share the same memory, and resolved by rolling back the SDK.

Byte Quality Assurance Team
Byte Quality Assurance Team
Byte Quality Assurance Team
Root Cause Analysis of Video Artifacts Caused by a P2P Box Upgrade

Background : Peer‑to‑peer (P2P) technology distributes video resources across user‑owned nodes called "boxes". An upgrade to a self‑developed P2P box caused video playback artifacts such as screen tearing and gray blocks.

Problem Manifestation : After the box version upgrade, users of the app that relied on the P2P module reported varying degrees of screen tearing and, in severe cases, large gray areas.

Discovery and Handling :

Technical support received on‑call reports of screen tearing.

R&D experiments showed the affected users all used the P2P feature, suspecting a specific P2P vendor operation.

Video soft‑decode error rates increased, concentrated on the self‑developed P2P.

Rollback of the box SDK eliminated the errors, confirming the upgrade as the cause.

Code Logic Background : The app requests multiple video fragments in a single request; the network thread splits these fragments and the storage thread processes them individually. The intended optimization was to batch multiple fragment requests into a single task queue.

Problematic Code Change : To reduce task dispatch count, the storage thread now maintains a std::vector<fw::Buffer> data(data.size(), fw::Buffer()); where each buffer was intended to hold separate fragment data.

Root Cause : The vector initialization copies the same fw::Buffer instance into every element, causing all buffers to point to the same memory region. When later fragments are written, later writes overwrite earlier data, resulting in corrupted or missing video frames and the observed screen tearing.

Solution : Rolling back the SDK code removed the faulty vector initialization, restoring correct fragment handling.

Takeaways and TODOs :

Establish a full‑process testing environment; all code changes must be validated in test before production deployment.

Monitor critical metrics such as decode‑failure rates, as screen tearing does not affect playback smoothness and would be missed by usual buffering or stutter metrics.

Implement a robust release workflow and root‑cause analysis mechanism.

Possible Causes of Video Screen‑Tearing :

Loss of reference frames (I/P/B frames) during decoding.

Player not starting decode from a key frame.

Hardware‑decoder compatibility issues.

Decoder initialization parameter errors or logic bugs.

Incorrect parameters passed to the rendering module.

GPU performance bottlenecks.

C++Video Streamingroot cause analysisp2pbackend debugging
Byte Quality Assurance Team
Written by

Byte Quality Assurance Team

World-leading audio and video quality assurance team, safeguarding the AV experience of hundreds of millions of users.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.