Patent ID: 11966398
Assignee: ZHEJIANG UNIVIEW TECHNOLOGIES CO., LTD.
Field: Audio-visual technology (Electrical engineering)
Classification: CPC G  H | IPC G

Claim 0:
1. A method for storing video data, applied to a terminal device comprising a video cache space, wherein the video cache space comprises a first cache space and a second cache space, a writing priority of the first cache space is higher than a writing priority of the second cache space, at least one piece of I-frame-group video data is able to be written into each of the first cache space and the second cache space, and the method comprises:
in a case of receiving I-frame data to be stored, detecting whether written data exists in the video cache space, wherein the I-frame data to be stored is comprised in I-frame-group video data to be stored;
in a case of detecting that the written data exists in the video cache space, reading a target writing position of the I-frame data to be stored and determining whether the target writing position is located within a position range corresponding to the written data in the first cache space;
in response to a determination result that the target writing position is located within the position range, determining that the I-frame data to be stored is write-back content in the I-frame-group video data to be stored, writing, based on the target writing position, the I-frame data to be stored to the first cache space for caching and detecting whether the first cache space is full; and
in a case of detecting that the first cache space is full, writing all video data in the video cache space to a memory space of the terminal device for storage and emptying the video cache space,
wherein the method further comprises:
in response to a determination result that the target writing position is not located within the position range, determining whether the target writing position is located after a cache position corresponding to the written data in the video cache space;
in response to a determination result that the target writing position is located after the cache position, determining that the I-frame data to be stored is data in the middle or at the end of a frame group in the I-frame-group video data to be stored, and detecting whether the second cache position is full; and
in a case of detecting that the second cache space is not full, writing, based on the target writing position, the I-frame data to be stored to the video cache space for caching; and in a case of detecting that the second cache space is full, writing all the video data cached in the video cache space to the memory space of the terminal device for storage, emptying the video cache space, and writing the I-frame data to be stored to the first cache space of the emptied video cache space for caching.