Rockchip · AI & Linux Hub

Cameras & video

Keeping slow snapshot uploads from blocking video recording on Rockchip

After capturing a picture, the file is written and uploaded synchronously in the camera callback.

When the network slows down, the entire collection link will be stopped. The recording needs to be continuous and the upload is allowed to be delayed. Different buffering and failure strategies should be adopted for the two. When designing, first write down how long each type of data is allowed to wait.

Calculate the cost of backlog

Assuming that each capture is 300 KB on average and two captures are captured per second, approximately 360 MB of data will be accumulated if the network is disconnected for ten minutes, and the directory and retry overhead have not yet been calculated. Whether the cache should be placed in memory or disk, and which category should be discarded when it is full, should be decided before going online.

Separate buffer life cycle

Frames handed over to the encoder by the recording thread may still be referenced before processing is completed. If the capture branch occupies the same pool buffer for a long time, it will reversely block the collection. You can copy low-frequency snapshots at specific locations, or introduce a capped independent buffer pool, and compare the actual overhead.

Retest recovery process

Pause the upload receiving end in the test environment and observe whether the recording timestamp is continuous and whether the disk has grown to the set upper limit. After the network is restored, limit the retransmission rate and check the number of videos and screenshots. Only by being able to continue recording in real time when the network is restored can the entire fault process be considered resolved.

Board documentation and references

ArmSoM Sige5

Products and development resources

Check the hardware revision, carrier, image and interfaces in the product documentation. An article association is not evidence that a configuration has been tested.

Explore this topic → · Learning paths →