CN105611307B - It is a kind of based on without lock buffer queue multichannel h264 video data caching method and system - Google Patents
It is a kind of based on without lock buffer queue multichannel h264 video data caching method and system Download PDFInfo
- Publication number
- CN105611307B CN105611307B CN201510954913.1A CN201510954913A CN105611307B CN 105611307 B CN105611307 B CN 105611307B CN 201510954913 A CN201510954913 A CN 201510954913A CN 105611307 B CN105611307 B CN 105611307B
- Authority
- CN
- China
- Prior art keywords
- data
- block
- sub
- frame data
- caching
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000003860 storage Methods 0.000 claims description 15
- 230000003111 delayed effect Effects 0.000 claims description 5
- 238000010008 shearing Methods 0.000 claims description 4
- 238000004519 manufacturing process Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 5
- 238000012360 testing method Methods 0.000 description 4
- 230000004087 circulation Effects 0.000 description 3
- 238000009826 distribution Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 241000208340 Araliaceae Species 0.000 description 1
- 241001269238 Data Species 0.000 description 1
- 235000005035 Panax pseudoginseng ssp. pseudoginseng Nutrition 0.000 description 1
- 235000003140 Panax quinquefolius Nutrition 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000008434 ginseng Nutrition 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000002035 prolonged effect Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/21—Server components or server architectures
- H04N21/218—Source of audio or video content, e.g. local disk arrays
- H04N21/2181—Source of audio or video content, e.g. local disk arrays comprising remotely distributed storage units, e.g. when movies are replicated over a plurality of video servers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
- H04N21/23406—Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving management of server-side video buffer
Abstract
The invention discloses a kind of multichannel h264 video data caching methods based on without lock buffer queue and system, this method to include:Obtain the current cache sub-block c for being directed to the first buffer queue1iThe multichannel h264 video data in a frame data;Judge whether the frame data are I frame data;When frame data are I frame data, by frame data write-in and current cache sub-block c1iCaching sub-block c in corresponding second buffer queue2i, and continue to obtain the next caching sub-block c for being directed to the first buffer queue1(i+1)Multichannel h264 video data in next frame data;When frame data are not I frame data, current cache sub-block c is written into frame data1i, and continue to obtain the next caching sub-block c for being directed to the first buffer queue1(i+1)Multichannel h264 video data in next frame data.As it can be seen that the present invention realizes the integrality for guaranteeing key frame (I frame), the frame-skipping phenomenon of video data is reduced, and then the purpose of the fluency and integrality when guarantee follow-up play video data.
Description
Technical field
The present invention relates to multi-path video data access technique fields, more particularly to a kind of based on without the more of lock buffer queue
Road h264 video data caching method and system.
Background technique
Now, with the rapid development of science and technology and social economy, people can record each of generation whenever and wherever possible
Class data, during recording Various types of data, the problem of people's major concern be how by the data monitored verily, it is complete
Site preparation is recorded, i.e., how to guarantee the reliability and integrality of storing data.
In practical applications, it usually needs the collected multi-path video data of multiple cameras is uninterrupted with constant rate of speed
Ground is written in distributed memory system, for example at the scene of some programme televised live, needs the collected video of numerous video cameras
Distributed memory system is written in data, is then being supplied to spectators by certain processing.
Existing based in the method deposited multi-path video data to distributed cache system without lock buffer queue, give birth to
Producing line journey and consuming thread share a caching, which is multiple caching sub-blocks.Thread is produced with constant rate of speed from more
A frame data are read in the video data of road and a caching sub-block in caching is written, and multiple consuming threads cache sub-block from this
One frame data of middle reading are deposited into file.A caching sub-block is often write, the count value for caching sub-block adds 1.
With reference to Fig. 1, when just starting, data are written into caching for production thread, and consuming thread, which starts to read, to be cached and be written
Into distributed system;Start to continue to write in caching when production thread writes full caching with reference to Fig. 2;When consuming thread
When reading speed is more many slowly than the writing speed for producing thread, consuming thread can skip capped block, then again from caching
It obtains, for example, after consuming thread has read 16, next should be 17, but be become 17 coverings by production thread in Fig. 3
At 25, at this moment, consuming thread can skip 25 and read 18.In this case, if 17 corresponding video datas are data
When measuring the higher data of bigger or important ratio, the frame-skipping phenomenon of video data is easily led to, and then will affect rear continued broadcasting
Fluency and integrality when putting this video data.
Summary of the invention
In view of this, the present invention provides it is a kind of based on without lock buffer queue multichannel h264 video data caching method and
System reduces the frame-skipping phenomenon of video data, and then guarantee follow-up play video data to realize the integrality for guaranteeing key frame
When fluency and integrality purpose.
In order to solve the above technical problems, the present invention provide it is a kind of slow based on the multichannel h264 video data without lock buffer queue
Method is deposited, this method includes:
Obtain the current cache sub-block c for being directed to the first buffer queue1iThe multichannel h264 video data in a frame number
According to;
Judge whether the frame data are I frame data;
When the frame data are I frame data, by frame data write-in and the current cache sub-block c1iCorresponding
Caching sub-block c in two buffer queues2i, and continue to obtain the next caching sub-block c for being directed to first buffer queue1(i+1)'s
Next frame data in the multichannel h264 video data;
When the frame data are not I frame data, the current cache sub-block c is written into the frame data1i, and continue to obtain
Take next caching sub-block c for first buffer queue1(i+1)The multichannel h264 video data in next frame number
According to;Work as i+1>When N, c1(i+1)For c11;
Wherein, the first buffer queue C1={ c11,c12,…,c1i,…,c1N, the second buffer queue C2=
{c21,c22,…,c2i,…,c2N, i=1,2,3 ... ..., N;c1iFor i-th of caching sub-block in first buffer queue,
c2iFor in second buffer queue with c1iCorresponding caching sub-block;The memory size of each caching sub-block is equal.
In the above method, it is preferable that after determining the frame data for I frame data, further include:
Judge the caching sub-block c2iIn whether have data;
As the caching sub-block c2iIn when having data, the current cache sub-block c is written into the frame data1i, and after
It is continuous to obtain next frame data;
As the caching sub-block c2iIn when not having data, the caching sub-block c is written into the frame data2i, and after
It is continuous to obtain next frame data.
In the above method, preferably further include:
The caching sub-block c of judgement and first buffer queue1jCaching in corresponding second buffer queue
Block c2jIn whether have data;J=1,2,3 ..., N;
As the caching sub-block c2jIn when having data, to the caching sub-block c2jIn data sheared, obtain to
It is stored in data;
As the caching sub-block c2jIn when not having data, obtain the caching sub-block c1jIn data be used as described in
Data to be deposited;
The data to be deposited are stored to distributed memory system.
In the above method, preferably after obtaining the data to be deposited, further include:
Return to the caching sub-block c for executing judgement with first buffer queue1(j+1)Corresponding second buffer queue
In caching sub-block c2(j+1)In whether have data;
Wherein, work as j+1>When N, c1(j+1)For c11, c2(j+1)For c21。
In the above method, preferably further include:
Record the current cache sub-block c for obtaining and being directed to first buffer queue1iThe multichannel h264 video counts
The acquisition time of a frame data in;
Record stores the data to be deposited to the access time of distributed memory system;
It is delayed the difference between the acquisition time and the access time as storage.
The present invention also provides a kind of based on the multichannel h264 video data caching system without lock buffer queue, the system packet
It includes:
First acquisition unit, for obtaining the current cache sub-block c for being directed to the first buffer queue1iThe multichannel h264 view
A frame data of the frequency in;
First judging unit, for judging whether the frame data are I frame data;
Writing unit, for when the frame data are I frame data, the frame data to be written and current cache
Block c1iCaching sub-block c in corresponding second buffer queue2i, and the first acquisition unit is notified to continue to obtain for described
Next caching sub-block c of first buffer queue1(i+1)The multichannel h264 video data in next frame data;When the frame
When data are not I frame data, the current cache sub-block c is written into the frame data1i, and notify the first acquisition unit after
It is continuous to obtain the next caching sub-block c for being directed to first buffer queue1(i+1)The multichannel h264 video data in next frame
Data;Work as i+1>When N, c1(i+1)For c11;
Wherein, the first buffer queue C1={ c11,c12,…,c1i,…,c1N, the second buffer queue C2=
{c21,c22,…,c2i,…,c2N, i=1,2,3 ... ..., N;c1iFor i-th of caching sub-block in first buffer queue,
c2iFor in second buffer queue with c1iCorresponding caching sub-block;The memory size of each caching sub-block is equal.
In above system, it is preferable that first judging unit be also used to determine the frame data for I frame data it
Afterwards, judge the caching sub-block c2iIn whether have data;
Said write unit is also used to as the caching sub-block c2iIn when having data, will work as described in frame data write-in
Preceding caching sub-block c1i, and the first acquisition unit is notified to continue to obtain next frame data;As the caching sub-block c2iIn
When not having data, the caching sub-block c is written into the frame data2i, and the first acquisition unit is notified to continue to obtain
Next frame data.
In above system, it is preferable that further include:
Second judgment unit, for judging and the caching sub-block c of first buffer queue1jCorresponding described second is slow
Deposit the caching sub-block c in queue2jIn whether have data;J=1,2,3 ..., N;
Second acquisition unit, for working as the caching sub-block c2jIn when having data, to the caching sub-block c2jIn number
According to being sheared, data to be deposited are obtained;As the caching sub-block c2jIn when not having data, obtain the caching sub-block
c1jIn data as the data to be deposited;
It is stored in unit, for storing the data to be deposited to distributed memory system.
In above system, it is preferable that further include:
The second judgment unit is also used to after obtaining the data to be deposited, is returned and is executed judgement and described the
The caching sub-block c of one buffer queue1(j+1)Caching sub-block c in corresponding second buffer queue2(j+1)In whether have
Data;
Wherein, work as j+1>When N, c1(j+1)For c11, c2(j+1)For c21。
In above system, it is preferable that further include:
Storage delay determination unit, for recording the current cache sub-block c obtained for first buffer queue1i
The multichannel h264 video data in a frame data acquisition time;Record stores the data to be deposited to distribution
The access time of storage system;It is delayed the difference between the acquisition time and the access time as storage.
It is above provided by the invention a kind of based on multichannel h264 video data caching method and system without lock buffer queue,
The I frame data in h246 video data, the first buffer queue and the second buffer queue are protected by two buffer queues of maintenance.
Specifically, first routinely means obtain the current cache sub-block c for being directed to the first buffer queue to production thread1iThe multichannel h264
A frame data in video data.When determining this frame data obtained for I frame data, which is written and current cache
Sub-block c1iCaching sub-block c in corresponding second buffer queue2i, and continue to obtain next frame data;When the frame number for determining to obtain
When according to not being I frame data, which is written into the current cache sub-block c1i, and continue to obtain next frame data.It is such
Words also can be avoided I frame data and do not disappeared even if the reading speed of consuming thread is more many slowly than the writing speed for producing thread
Take before thread is read and be capped (in the first buffer queue), and when consuming thread reads caching sub-block c1iWhen, if
Cache sub-block c2iThere are I frame data, it can be from caching sub-block c2iRead I frame data.As it can be seen that the present invention realizes guarantee key frame
The integrality of (I frame), reduces the frame-skipping phenomenon of video data, and then fluency when guaranteeing follow-up play video data and complete
The purpose of property.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is the first schematic diagram of data cache method in the prior art;
Fig. 2 is the second schematic diagram of data cache method in the prior art;
Fig. 3 is the third schematic diagram of data cache method in the prior art;
Fig. 4 is provided in an embodiment of the present invention a kind of based on the multichannel h264 video data caching method without lock buffer queue
A flow chart;
Fig. 5 is provided in an embodiment of the present invention a kind of based on the multichannel h264 video data caching method without lock buffer queue
Another flow chart;
Fig. 6 is provided in an embodiment of the present invention a kind of based on the multichannel h264 video data caching method without lock buffer queue
Another flow chart;
Fig. 7 is provided in an embodiment of the present invention a kind of based on the multichannel h264 video data caching system without lock buffer queue
Structural block diagram schematic diagram.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Core of the invention be to provide it is a kind of based on without lock buffer queue multichannel h264 video data caching method and be
System, to realize the integrality for guaranteeing key frame, when reducing the frame-skipping phenomenon of video data, and then guaranteeing follow-up play video data
Fluency and integrality purpose.
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description
The present invention is described in further detail.
It is shown with reference to Fig. 4, Fig. 4 provided in an embodiment of the present invention a kind of based on the multichannel h264 video without lock buffer queue
The flow chart of data cache method, this method can specifically include following steps:
Step S100, the current cache sub-block c for being directed to the first buffer queue is obtained1iMultichannel h264 video data in one
Frame data;
The executing subject of method provided by the embodiment of the present invention is based on the multichannel h264 video counts without lock buffer queue
According to caching system, it is mainly used in and the collected h264 code stream of multi-path camera is written to distributed storage system with constant rate of speed
The scene of system.In description section of the embodiment of the present invention, mainly with production thread and consuming thread simulation test, by multichannel
The collected h264 code stream of camera is written to distributed memory system with constant rate of speed, while using improved queue, can protect
The integrality of key frame is demonstrate,proved, to reduce frame-skipping phenomenon when video storage.Those skilled in the art can be for specific real
Border application carries out adaptable transformation.
In the present invention, produces thread and consuming thread safeguards two buffer queues, the first buffer queue C jointly1={ c11,
c12,…,c1i,…,c1NAnd the second buffer queue C2={ c21,c22,…,c2i,…,c2N, wherein i=1,2,3 ... ..., N;
c1iFor i-th of caching sub-block in the first buffer queue, c2iFor in the second buffer queue with c1iCorresponding caching sub-block;Respectively
The memory size for caching sub-block is equal, and the memory of each caching sub-block is greater than the size of each frame of h264 video.
For c2iFor in the second buffer queue with c1iCorresponding caching sub-block, it is meant that, by the first buffer queue
C1iThe c in corresponding second buffer queue can be found2i, further, since each caching sub-block is respective
There is index number in buffer queue, it can be by c1iAnd c2iIndex number be set as the same, be mapped so conveniently.Than
Such as, c1iIndex number in the first buffer queue is i, c2iIndex number in the second buffer queue is also i.Step
S101, judge whether the frame data are I frame data;When frame data are I frame data, S102 is entered step, otherwise, is entered step
S103.
(the I frame completely encoded, what it is with reference to I frame generation before only includes difference to three kinds of frames based on H264 video data
The B frame of the P frame of code segment and the frame coding of reference front and back) in I frame data volume it is big and effect is great, therefore, it is necessary to I
Frame data are protected, it is not allowed to be capped before not read by consuming thread.And for other P frames or B frame, even if
It is capped one liang of frame, the influence degree to the display effect of final video data is negligible, because human eye is several
Do not discover.
In the specific implementation process, the acquisition rate, the cache size of distribution, each consuming thread for producing thread are write out
Number of files, consuming thread number, runing time of program that file size, each consuming thread write out in total etc. can lead to
It is specified to cross configuration file.Meanwhile after program operation, the number of consuming thread can be increased by order.
Step S102, by frame data write-in and current cache sub-block c1iCaching sub-block in corresponding second buffer queue
c2i, and continue to obtain the next caching sub-block c for being directed to the first buffer queue1(i+1)Multichannel h264 video data in next frame
Data;
It wherein, is therefore to work as i+1 without lock buffer queue based on two buffer queues in the present invention>When N, c1(i+1)For
c11, that is, return to first caching sub-block and continue to obtain for this caching sub-block progress data acquisition, circuit sequentially.It is understood that
, it is involved in the present invention to avoid I frame data are capped from referring to that it is avoided to be capped before consuming thread reading,
Because since consuming thread has had read, that would not follow-up storage to video data, play and have an impact.
Step S103, current cache sub-block c is written into frame data1i, and continue to obtain for the next of the first buffer queue
Cache sub-block c1(i+1)Multichannel h264 video data in next frame data.
To sum up, even if the reading speed of consuming thread is more many slowly than the writing speed for producing thread, it also can be avoided I frame number
It is capped according to before not read by consuming thread, and when consuming thread reads caching sub-block c1iWhen, if caching sub-block
c2iThere are I frame data, it can be from caching sub-block c2iRead I frame data.As it can be seen that the present invention, which realizes, guarantees the complete of key frame (I frame)
Whole property reduces the frame-skipping phenomenon of video data, and then the purpose of the fluency and integrality when guarantee follow-up play video data.
Based on technical solution disclosed in the embodiments of the present invention, two cachings are written into datacycle in production thread
(using i as loop parameter) during queue, consuming thread is equally to circulate in always from the two buffer queues to read
Data simultaneously deposit the data read to distributed memory system (using j as loop parameter), another embodiment of the present invention provides
The reading process of consuming thread, referring to FIG. 5, specifically include following content:
Step S200, when consuming thread is to the caching sub-block c of the first buffer queue1jWhen being read out, judgement is slow with first
Deposit the caching sub-block c of queue1jCaching sub-block c in corresponding second buffer queue2jIn whether have data;When caching
Block c2jIn when having data, enter step S201, otherwise, enter step S202.
Wherein, j=1,2,3 ... ..., N.
Step S201, to caching sub-block c2jIn data sheared, obtain data to be deposited.
Step S202, caching sub-block c is obtained1jIn data as data to be deposited.
It is understood that after obtaining data to be deposited, it is also necessary to return and execute judgement and the first buffer queue
Cache sub-block c1(j+1)Caching sub-block c in corresponding second buffer queue2(j+1)In whether have data;Wherein, work as j+1>N
When, c1(j+1)For c11, c2(j+1)For c21。
Step S203, data to be deposited are stored to distributed memory system.
For example, being equally c1iIndex number in the first buffer queue is i, c2iIn the second buffer queue
Index number is also i.Caching sub-block c of sequence of the consuming thread according to j from 1 to N from the first buffer queue1jMiddle reading data,
Judgement and c are but needed before reading1jCorresponding c2jWhether I frame data are had.Work as c2jIn when having data, it is believed that originally
It should be in c1jI frame data on position are stored to c2jIn, so, by c2jIn I frame data shearing be used as c2jNumber on position
According to deposit distributed memory system;Work as c2jIn when not having data, just by normal directly by c1jIt is as data to be deposited
It can.
Furthermore it is also possible to record the current cache sub-block c for obtaining and being directed to the first buffer queue1iMultichannel h264 video data
In a frame data acquisition time;Record stores data to be deposited to the access time of distributed memory system;It will acquire
Difference between time and access time is as storage delay.According to this storage delay, the delay of entire scheme can be determined
Performance.
Furthermore the test video (i.e. the video of production thread write-in caching) used is the h264 video with digital dock
File opens the file that consuming thread generates in order to which video player during the test and after the completion of test, can be used,
Observe the Caton situation of video.
Based on technical solution disclosed in each embodiment of aforementioned present invention, avoid I frame data in the first buffer queue
On the basis of capped, in order to further ensure I frame data will not be capped in the second buffer queue, another reality of the present invention
It applies example and provides corresponding solution, particular content please refers to Fig. 6:
Step S300, determining to be directed to c1iFrame data be I frame data after, judgement and c1iCorresponding caching sub-block c2i
In whether have data;As caching sub-block c2iIn when having data, enter step S301, otherwise, enter step S202.
Step S301, current cache sub-block c is written into frame data1i, and continue to obtain next frame data.
Step S302, caching sub-block c is written into frame data2i, and continue to obtain next frame data.
As caching sub-block c2iIn when having data, it is believed that thread is produced in upper primary circulation to c2iIt is stored in an I
Frame data, and since operation of the consuming thread when reading the I frame data in the second buffer queue is shearing, c2i
In have data and illustrate that consuming thread is not read away also, in this case, to avoid c2iIn I frame data it is capped, just
The frame data write-in c that will acquire1i, and continue to obtain next frame data.
As caching sub-block c2iIn when not having data, the frame data write-in c that can directly will acquire2i。
As caching sub-block c2iIn when having data, it is believed that thread is produced in upper primary circulation to c2iIt is stored in an I
Frame data, and since operation of the consuming thread when reading the I frame data in the second buffer queue is shearing, c2i
In have data and illustrate that consuming thread is not read away also, in this case, to avoid c2iIn I frame data it is capped, just
The frame data write-in c that will acquire1i, and continue to obtain next frame data.As caching sub-block c2iIn when not having data, can be straight
Meet the frame data write-in c that will acquire2i。
It in summary it can be seen, the caching sub-block c that I frame data can number in two buffer queues with respective index1i
And c2iBetween alternately store, specifically deposit c1i, just deposit c next time2i, understandable to be, such method of depositing is each I frame data
The safety time that ensure that thread two circulations of production, in write-in speed of the reading speed of certain consuming thread than producing thread
It spends in slow range, this range has been set according to actual conditions, guarantee to be recycled to c in production thread third time enough1iBefore
Consuming thread is from c1iOr c2iI frame data are read away.
Based on the embodiments of the present invention provide based on without lock buffer queue multichannel h264 video data caching method,
It is somebody's turn to do based on the multichannel h264 video data caching system without lock buffer queue with reference to Fig. 7 the embodiment of the invention also provides a kind of
System 700 may include following content:
First acquisition unit 701, for obtaining the current cache sub-block c for being directed to the first buffer queue1iMultichannel h264 view
A frame data of the frequency in;
First judging unit 702, for judging whether frame data are I frame data;
Writing unit 703, for when frame data are I frame data, frame data to be written and current cache sub-block c1iIt is corresponding
The second buffer queue in caching sub-block c2i, and first acquisition unit is notified to continue to obtain for the next of the first buffer queue
Cache sub-block c1(i+1)Multichannel h264 video data in next frame data;When frame data are not I frame data, by frame data
Current cache sub-block c is written1i, and first acquisition unit is notified to continue to obtain the next caching sub-block for being directed to the first buffer queue
c1(i+1)Multichannel h264 video data in next frame data;Work as i+1>When N, c1(i+1)For c11;
Wherein, the first buffer queue C1={ c11,c12,…,c1i,…,c1N, the second buffer queue C2={ c21,c22,…,
c2i,…,c2N, i=1,2,3 ... ..., N;c1iFor i-th of caching sub-block in the first buffer queue, c2iFor the second buffer queue
In with c1iCorresponding caching sub-block;The memory size of each caching sub-block is equal.
In the present invention, the first judging unit 701 is also used to after determining frame data for I frame data, judges to cache sub-block
c2iIn whether have data;
Writing unit 703 is also used to as caching sub-block c2iIn when having data, current cache sub-block is written into frame data
c1i, and first acquisition unit is notified to continue to obtain next frame data;As caching sub-block c2iIn when not having data, by frame number
Sub-block c is cached according to write-in2i, and first acquisition unit is notified to continue to obtain next frame data.
In the present invention, above system 700 specifically can also include following content:
Second judgment unit, for judging and the caching sub-block c of the first buffer queue1jIn corresponding second buffer queue
Caching sub-block c2jIn whether have data;J=1,2,3 ..., N;
Second acquisition unit, for as caching sub-block c2jIn when having data, to caching sub-block c2jIn data cut
It cuts, obtains data to be deposited;As caching sub-block c2jIn when not having data, obtain caching sub-block c1jIn data be used as to
It is stored in data;
It is stored in unit, for storing data to be deposited to distributed memory system.
In the present invention, above-mentioned second judgment unit is also used to after obtaining data to be deposited, is returned and is executed judgement and the
The caching sub-block c of one buffer queue1(j+1)Caching sub-block c in corresponding second buffer queue2(j+1)In whether have data;
Wherein, work as j+1>When N, c1(j+1)For c11, c2(j+1)For c21。
In the present invention, above system 700 specifically can also include storage delay determination unit, obtain for recording for the
The current cache sub-block c of one buffer queue1iMultichannel h264 video data in a frame data acquisition time;Record will be wait deposit
Enter data to store to the access time of distributed memory system;The difference that will acquire between time and access time is prolonged as storage
When.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight
Point explanation is all differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
For system class embodiment, since it is basically similar to the method embodiment, so describe fairly simple, related place ginseng
See the part explanation of embodiment of the method.
Above to it is provided by the present invention it is a kind of based on without lock buffer queue multichannel h264 video data caching method and
System is described in detail.It is used herein that a specific example illustrates the principle and implementation of the invention, with
The explanation of upper embodiment is merely used to help understand method and its core concept of the invention.It should be pointed out that being led for this technology
For the those of ordinary skill in domain, without departing from the principle of the present invention, can also to the present invention carry out it is several improvement and
Modification, these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims (10)
1. a kind of based on the multichannel h264 video data caching method without lock buffer queue, which is characterized in that this method includes:
Obtain the current cache sub-block c for being directed to the first buffer queue1iThe multichannel h264 video data in a frame data;
Judge whether the frame data are I frame data;
When the frame data are I frame data, by frame data write-in and the current cache sub-block c1iCorresponding second is slow
Deposit the caching sub-block c in queue2i, and continue to obtain the next caching sub-block c for being directed to first buffer queue1(i+1)It is described
Next frame data in multichannel h264 video data;
When the frame data are not I frame data, the current cache sub-block is written into the frame datac1i, and continue to obtain needle
To next caching sub-block c of first buffer queue1(i+1)The multichannel h264 video data in next frame data;Work as i
+1>When N, c1(i+1)For c11;
Wherein, the first buffer queue C1={ c11,c12,…,c1i,…,c1N, the second buffer queue C2={ c21,
c22,…,c2i,…,c2N, i=1,2,3 ... ..., N;c1iFor i-th of caching sub-block in first buffer queue, c2iFor
In second buffer queue with c1iCorresponding caching sub-block;The memory size of each caching sub-block is equal.
2. the method as described in claim 1, which is characterized in that after determining the frame data for I frame data, further include:
Judge the caching sub-block c2iIn whether have data;
As the caching sub-block c2iIn when having data, the current cache sub-block c is written into the frame data1i, and continue to obtain
Take next frame data;
As the caching sub-block c2iIn when not having data, the caching sub-block c is written into the frame data2i, and continue to obtain
Take next frame data.
3. method according to claim 1 or 2, which is characterized in that further include:
The caching sub-block c of judgement and first buffer queue1jCaching sub-block c in corresponding second buffer queue2j
In whether have data;J=1,2,3 ..., N;
As the caching sub-block c2jIn when having data, to the caching sub-block c2jIn data sheared, obtain to be deposited
Data;
As the caching sub-block c2jIn when not having data, obtain the caching sub-block c1jIn data as described to be deposited
Data;
The data to be deposited are stored to distributed memory system.
4. method as claimed in claim 3, which is characterized in that after obtaining the data to be deposited, further include:
Return to the caching sub-block c for executing judgement with first buffer queue1(j+1)In corresponding second buffer queue
Cache sub-block c2(j+1)In whether have data;
Wherein, work as j+1>When N, c1(j+1)For c11, c2(j+1)For c21。
5. method as claimed in claim 4, which is characterized in that further include:
Record the current cache sub-block c for obtaining and being directed to first buffer queue1iThe multichannel h264 video data in
A frame data acquisition time;
Record stores the data to be deposited to the access time of distributed memory system;
It is delayed the difference between the acquisition time and the access time as storage.
6. a kind of based on the multichannel h264 video data caching system without lock buffer queue, which is characterized in that the system includes:
First acquisition unit, for obtaining the current cache sub-block c for being directed to the first buffer queue1iThe multichannel h264 video counts
A frame data in;
First judging unit, for judging whether the frame data are I frame data;
Writing unit, for when the frame data are I frame data, the frame data to be written and the current cache sub-block c1i
Caching sub-block c in corresponding second buffer queue2i, and it is slow for described first to notify that the first acquisition unit continues to obtain
Deposit next caching sub-block c of queue1(i+1)The multichannel h264 video data in next frame data;When the frame data not
When for I frame data, the current cache sub-block c is written into the frame data1i, and the first acquisition unit is notified to continue to obtain
For next caching sub-block c of first buffer queue1(i+1)The multichannel h264 video data in next frame data;
Work as i+1>When N, c1(i+1)For c11;
Wherein, the first buffer queue C1={ c11,c12,…,c1i,…,c1N, the second buffer queue C2={ c21,
c22,…,c2i,…,c2N, i=1,2,3 ... ..., N;c1iFor i-th of caching sub-block in first buffer queue, c2iFor
In second buffer queue with c1iCorresponding caching sub-block;The memory size of each caching sub-block is equal.
7. system as claimed in claim 6, which is characterized in that
First judging unit is also used to after determining the frame data for I frame data, judges the caching sub-block c2iIn
Whether data are had;
Said write unit is also used to as the caching sub-block c2iIn when having data, frame data write-in is described current slow
Deposit sub-block c1i, and the first acquisition unit is notified to continue to obtain next frame data;As the caching sub-block c2iIn do not have
When having data, the caching sub-block c is written into the frame data2i, and the first acquisition unit is notified to continue described in acquisition
Next frame data.
8. system as claimed in claims 6 or 7, which is characterized in that further include:
Second judgment unit, for judging and the caching sub-block c of first buffer queue1jCorresponding second caching team
Caching sub-block c in column2jIn whether have data;J=1,2,3 ..., N;
Second acquisition unit, for working as the caching sub-block c2jIn when having data, to the caching sub-block c2jIn data into
Row shearing, obtains data to be deposited;As the caching sub-block c2jIn when not having data, obtain the caching sub-block c1jIn
Data as the data to be deposited;
It is stored in unit, for storing the data to be deposited to distributed memory system.
9. system as claimed in claim 8, which is characterized in that further include:
The second judgment unit is also used to after obtaining the data to be deposited, is returned to execution judgement and is delayed with described first
Deposit the caching sub-block c of queue1(j+1)Caching sub-block c in corresponding second buffer queue2(j+1)In whether have data;
Wherein, work as j+1>When N, c1(j+1)For c11, c2(j+1)For c21。
10. system as claimed in claim 9, which is characterized in that further include:
Storage delay determination unit, for recording the current cache sub-block c obtained for first buffer queue1iInstitute
State the acquisition time of the frame data in multichannel h264 video data;Record stores the data to be deposited to distributed storage
The access time of system;It is delayed the difference between the acquisition time and the access time as storage.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510954913.1A CN105611307B (en) | 2015-12-17 | 2015-12-17 | It is a kind of based on without lock buffer queue multichannel h264 video data caching method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510954913.1A CN105611307B (en) | 2015-12-17 | 2015-12-17 | It is a kind of based on without lock buffer queue multichannel h264 video data caching method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105611307A CN105611307A (en) | 2016-05-25 |
CN105611307B true CN105611307B (en) | 2018-11-23 |
Family
ID=55990800
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510954913.1A Active CN105611307B (en) | 2015-12-17 | 2015-12-17 | It is a kind of based on without lock buffer queue multichannel h264 video data caching method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105611307B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106101737B (en) * | 2016-06-15 | 2019-05-07 | 南京云恩通讯科技有限公司 | A kind of framing control method for supporting real-time video caching multichannel to read |
CN110312156B (en) * | 2018-03-27 | 2022-04-22 | 腾讯科技(深圳)有限公司 | Video caching method and device and readable storage medium |
CN113727175A (en) * | 2021-08-11 | 2021-11-30 | 西安诺瓦星云科技股份有限公司 | Multi-channel video source playback method and system and display control equipment |
CN115955576B (en) * | 2023-03-10 | 2023-06-09 | 深圳市泛联信息科技有限公司 | Video data access method, device, storage node and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1946079A (en) * | 2006-11-02 | 2007-04-11 | 北京大学 | Selective frame losing method for network bandwidth self adaptive flow medium transmission |
US7688736B1 (en) * | 2003-05-05 | 2010-03-30 | Marvell International Ltd | Network switch with quality of service flow control |
CN101843099A (en) * | 2007-10-31 | 2010-09-22 | 派尔高公司 | Apparatus and method of storing video data |
CN104967856A (en) * | 2015-06-25 | 2015-10-07 | 华为技术有限公司 | Coding method and corresponding device |
-
2015
- 2015-12-17 CN CN201510954913.1A patent/CN105611307B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7688736B1 (en) * | 2003-05-05 | 2010-03-30 | Marvell International Ltd | Network switch with quality of service flow control |
CN1946079A (en) * | 2006-11-02 | 2007-04-11 | 北京大学 | Selective frame losing method for network bandwidth self adaptive flow medium transmission |
CN101843099A (en) * | 2007-10-31 | 2010-09-22 | 派尔高公司 | Apparatus and method of storing video data |
CN104967856A (en) * | 2015-06-25 | 2015-10-07 | 华为技术有限公司 | Coding method and corresponding device |
Also Published As
Publication number | Publication date |
---|---|
CN105611307A (en) | 2016-05-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105611307B (en) | It is a kind of based on without lock buffer queue multichannel h264 video data caching method and system | |
US11500586B2 (en) | Data read-write method and apparatus and circular queue | |
CN104115133B (en) | For method, system and the equipment of the Data Migration for being combined non-volatile memory device | |
US20180039574A1 (en) | Cache allocation for disk array | |
CN103348690B (en) | A kind of method and device of Video processing | |
CN105763825B (en) | A method of frame synchronization recording function is optimized in gaming | |
DE102009046847A1 (en) | More class data cache method | |
DE102011101202A1 (en) | Non-volatile storage for graphics hardware | |
CN104967807B (en) | Caching method and apparatus | |
WO2012122209A3 (en) | Caching method and system for video coding | |
US9478252B2 (en) | Smooth playing of video | |
DE102012221504A1 (en) | Multi-level instruction cache-Previously-Get | |
KR20100069240A (en) | Apparatus and method for cache control | |
DE102013114351A1 (en) | System and method for hardware scheduling conditional barriers and impatient barriers | |
DE102012220277A1 (en) | Rake-task-state encapsulation | |
DE102013208421A1 (en) | Sharing a graphics processing unit among many applications | |
CN109086141A (en) | EMS memory management process and device and computer readable storage medium | |
CN101785006A (en) | Method and apparatus for encoding and decoding multimedia data | |
WO2017015891A1 (en) | Monitoring data writing method and apparatus | |
CN112202800B (en) | VR video edge prefetching method and system based on reinforcement learning in C-RAN architecture | |
DE102013100169A1 (en) | Computer-implemented method for selection of a processor, which is incorporated in multiple processors to receive work, which relates to an arithmetic problem | |
CN107333169A (en) | A kind of client-cache method of adjustment and device | |
CN104869360B (en) | Video acquisition and display synchronous method and device | |
CN107222699A (en) | Method and capture apparatus that a kind of video preprocessor is shot | |
DE102019133027A1 (en) | DATA STORAGE SYSTEMS AND METHODS FOR SELF-ADAPTIVE CHIP RELEASE SETUP TIME |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |