Timing Control and Reference Counting Philosophy

Time:2022-10-13

Today I was listening to a T10 defense, and there is an idea that I find very interesting, so I will record it.

background:

The download video business layer uses Service, and the same download task can only correspond to one playback behavior.
Problems can arise if two services download the same video in the following order:

Timing Control and Reference Counting Philosophy

When I first heard this question, the first solution that came to my mind was to control the sequence with code, check business A before business B, and ensure that when business B is called, business A has stopped.

Timing Control and Reference Counting Philosophy

However, this processing method is only a solution to the current problem. If there is a similar situation with business C and business D in the future, special processing is still required.

A plan given by the defending students is very simple, but very interesting:

It implements reference counting logic for the player. Only when the reference count is zero will the download task be completely removed.

We know reference counting by heart, but I think it’s awesome to think of using this solution to solve problems.


**This official account will continue to update the technical solutions, pay attention to the technical trends in the industry, pay attention to the low cost, and the loss of missing dry goods is not small.
↓↓↓**
Timing Control and Reference Counting Philosophy