CN102752193B - A kind of fast cache method of live TV stream - Google Patents
A kind of fast cache method of live TV stream Download PDFInfo
- Publication number
- CN102752193B CN102752193B CN201210166973.3A CN201210166973A CN102752193B CN 102752193 B CN102752193 B CN 102752193B CN 201210166973 A CN201210166973 A CN 201210166973A CN 102752193 B CN102752193 B CN 102752193B
- Authority
- CN
- China
- Prior art keywords
- data
- stream
- array
- live
- queue
- 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.)
- Expired - Fee Related
Links
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The invention discloses a kind of fast cache method of live TV stream, it adopts acyclic queue form to build round-robin queue, the mode of fixed point access is utilized to carry out buffering access process, namely the mode of array is adopted to build circular buffering queue, utilize continuous seq for basic point rapidly locating deposit position, make the time complexity of searching continuously of circular buffering queue reduce to O (1).While achieving fast cache, effectively reduce the performance cost of service.Step comprises: in mobile stream media system, arrange live TV stream Buffer Pool, and streaming media data cushion, and smoothly play live TV stream for mobile terminal; Adopt the mode of array to build circular buffering queue, carry out locator data deposit position using continuous print Data Identification sequence number (Seq) as basic point.
Description
Technical field
The present invention relates to technical field of network multimedia, particularly relate to a kind of method of the live TV stream fast cache for mobile communications network.
Background technology
During the stream of live class is served at the scene, conventional P C application can use the level and smooth problem play of large buffer memory perfection process of PC.But because internal memory is relatively little on mobile phone, service end is needed more to participate in level and smooth process of playing, so need to cushion most live data to ensure that the mobile phone connected at any time has data to play in service end, need different buffering load positions and the process of Continuous Play to each connection, the search performance of each load position will become service main performance expense.
In traditional audio/video flow service, for the live class service of framing, the Buffer Pool of an audio/video flow is designed in service end, the design of common buffer queue is by stl(STL) realize in list(queue) based on, in conjunction with some data element composition data base node, the mode of " decaptitate and deposit tail " is then adopted to carry out datacycle renewal to buffer queue.When needs access data, be that key value is searched list according to the timestamp of data base node or sequence number, because queue circulation upgrades, except under complete match condition when searching, other situations can not use some the existing algorithms in stl, and the method for searching loop can only be adopted to carry out, time complexity is O (n), when buffer queue is longer, when needing service large concurrent user, cause performance cost very large simultaneously.
Publication date is on 07 27th, 2011, publication number is CN102137124A patent document discloses such technical scheme, a kind of P2P stream media live broadcasting method and system, and the method comprises: the state of the data buffer zone of monitoring live broadcast stream media; When the data of data buffer zone do not fill up data security region, client node is preferentially to compensating live broadcast stream media data corresponding to server request; When the data of data buffer zone fill up data security region, client node according to the scoring of upper layer node to upper layer node request live broadcast stream media data.This technical scheme needs to increase and compensates the equipment such as server, and detects buffering area, carries out the operations such as Scoring System to upper layer node, such that system configuration is complicated, process is loaded down with trivial details, and performance cost is large.
Summary of the invention
The invention provides a kind of fast cache method of live TV stream, it makes the buffer position of each connection search complexity is O (1), while achieving fast cache, effectively reduces the performance cost of service.
The present invention is directed to that prior art problem mainly solved by following technical proposals, a kind of fast cache method of live TV stream, comprising:
A. in mobile stream media system, arrange live TV stream Buffer Pool, streaming media data cushion, and smoothly play live TV stream for mobile terminal;
B. adopt the mode of array to build circular buffering queue, carry out locator data deposit position using continuous print Data Identification sequence number (Seq) as basic point;
C. buffering accessing operation is carried out by deposit position streaming media data.
In mobile stream media system, such as in mobile phone television system, the Buffer Pool of larger capacity is set.On the lookup method of buffer queue, the time of searching is the algorithm of constant is the fastest.Therefore, the technical program adopts the mode of array index access, and make the time of searching be constant, the time of searching can not change with the size of array, thus most effective, and time complexity is constant order O (1).
In operation, take array as the file layout of data base elements set, the preservation of data do not use STL(STL) in pushback(from tail of the queue stored in) etc. generic way, but have employed discrete logging mode.When fetching data, according to the modulo operation of Data Identification sequence number to array length, determine the deposit position of data base elements in array.This buffer queue design, each connection user can be allowed when searching certain data base elements, and under complete hit situation, time complexity is O (1), is O (1+n/3) under incomplete hit situation.Effectively accelerate seek rate, decrease the workload of CPU.
As preferably, array is array of pointers, and array length is determined according to required buffer queue size.The length of array is determined according to buffer queue actual demand.
As preferably, buffer queue size is determined according to setting duration and video frame rate.Such as can calculate buffer queue size according to 15 minutes durations and video frame rate.
As preferably, the pointer that the base unit of array comprises Data Identification sequence number (Seq), timestamp (pts) and point to actual flow media data.
The beneficial effect that the present invention brings is, acyclic queue form is adopted to build round-robin queue, the mode of fixed point access is utilized to carry out buffering access process, namely the mode of array is adopted to build circular buffering queue, utilize continuous seq for basic point rapidly locating deposit position, make the time complexity of searching continuously of circular buffering queue reduce to O (1).While achieving fast cache, effectively reduce the performance cost of service.
Summary of the invention
Below by embodiment, and by reference to the accompanying drawings, technical scheme of the present invention is further described in detail.
Embodiment 1: as shown in Figure 1, the present invention is a kind of fast cache method of live TV stream, and basic procedure comprises:
Step 101, arranges Buffer Pool on the server, and streaming media data cushion, and smoothly play live TV stream for mobile terminal;
Step 102, according to setting duration and video frame rate determination buffer queue size;
Step 103, deposit data, the base unit of stream medium data is according to the position of sequence number Seq value stored in correspondence in array;
Step 104, fetches data, and according to Data Identification sequence number Seq to the modulo operation of array length, determines the deposit position of the base unit of stream medium data in array;
Buffering access process is carried out by the above-mentioned position streaming media data that deposit, withdraw.
Figure 2 shows that data structure diagram, buffer queue is formed primarily of three parts:
A. an array of pointers, its array length is determined according to required buffer queue size (actual demand), is calculate according to 15 minutes durations and video frame rate in the present embodiment.
B. the base unit structure of stream medium data, this structure includes the pointer of seq sequence number, pts timestamp and a sensing actual flow media data.
C. the physical memory storage configuration of stream medium data, the realization of this structure can be varied, and the present embodiment uses continuous print memory block to store, and distinguishes different Frames by the base unit structure b of stream medium data.
Embodiment 2, the data adopting class C language to realize buffering are preserved, the method for data search:
1, data save method:
void Push(BStruct* package)
{
/ * ppAarray be in figure mono-represent A array */
If (ppAarray is empty)
{
/ * establishment ppAarray array */
ppAarray = new BStruct*[maxLen];
}
Seq sequence number element * in/* acquisition BStruct structure/
DWORD seq = package->seq();
This step of/* is crucial, and stream medium data base unit is according in the unit of the Data Identification sequence number Seq of self stored in relevant position in array, and sequence number exceeds array maximum length, to maximum length remainder */
PpAarray [seq is to manLen remainder]=package;
/ * upgrade current queue tail of the queue */
TailIdx = seq % maxLen;
/ * queue head has been bitten by afterbody, head obtain move forward */
if (seq > maxLen && HeadIdx == TailIdx){
HeadIdx = (TailIdx + 1) % maxLen;
}
}
Key in data save method is that the base unit of stream medium data will preserve position corresponding in array according to Data Identification sequence number Seq value, array itself does not need to carry out the operations such as internal data displacement, this, relative to the pushback of dynamic array or LIST, performance embodies also better.
2, data search method:
void Find(int seq, int pts, DataType& refVec)
{
/ * DataType be BStruct pointer dynamic number set type */
if (maxLen <=0){
/ * judges whether buffer queue has data, then directly do not return unsuccessfully */
return;
}
int dwptsprv = pts;
/ * according to seq calculation of parameter search position * that data deposit in array/
int dwindex = seq % maxLen;
BStruct* pPack = NULL;
If/* sequence number is 0, to represent from queue heads */
if (0 == dwseqprv){
dwindex = HeadIdx % maxLen;
}
/ * directly obtain from array stream medium data base unit */
pPack = ppAarray[dwindex];
if (pPack){
/ * judge the data of first fit whether mate completely */
DWORD packpts = pPack->GetPts();
if (packpts >= dwptsprv){
refVec.push_back(pPack);
}
}else{
If on/* first fit position in array not stored in data, then compare queue tail data whether effectively */
pPack = ppAarray[TailIdx];
if (seq >= pPack->GetSeq()){
If/* tail data timestamp is also less than required value, illustrate that data buffering is unripe, the * that directly exits find/
return;
}
}
/ * first fit is under hit situation, carry out behind the position of first fit traversal search */
for (;;){
/ * travels through matched and searched from dwindex position to TailIdx, and this operation only can occur when searching first, the follow-up consecutive access precondition of searching due to seq, all can enter the logic * that mates completely/
}
}
When having had data to preserve by Seq stored in basis, the taking-up of data just becomes very simple, according to the modulo operation of Seq to array length, just can determine the deposit position of stream medium data base unit in array.Because buffer queue is the cause that circulation upgrades, when searching first, likely can not mate completely, need down to travel through from the head of queue, in this case the longlyest search the length n that distance is queue, when second time is searched, because seq is continuous print, search length will become 1.
So the present invention has following characteristics: adopt acyclic queue form to build round-robin queue, the mode of fixed point access is utilized to carry out buffering access process, namely the mode of array is adopted to build circular buffering queue, utilize continuous seq for basic point rapidly locating deposit position, make the time complexity of searching continuously of circular buffering queue reduce to O (1).While achieving fast cache, effectively reduce the performance cost of service.
Accompanying drawing explanation
Figure 1 shows that a kind of basic flow sheet of the present invention;
Figure 2 shows that a kind of data structure diagram of the present invention.
Claims (1)
1. a fast cache method for live TV stream, is characterized in that comprising: arrange Buffer Pool on the server, and streaming media data cushion, and smoothly play live TV stream for mobile terminal;
According to setting duration and video frame rate determination buffer queue size;
Deposit data, the base unit of stream medium data is according to the position of sequence number Seq value stored in correspondence in array;
Fetch data, according to Data Identification sequence number Seq to the modulo operation of array length, determine the deposit position of the base unit of stream medium data in array;
Buffering access process is carried out by the above-mentioned position streaming media data that deposit, withdraw,
Buffer queue is formed primarily of three parts:
An array of pointers, its array length is determined according to required buffer queue size,
The base unit of stream medium data, the base unit of this stream medium data includes the pointer of seq sequence number, pts timestamp and a sensing actual flow media data, the physical memory storage configuration of stream medium data, use continuous print memory block to store, distinguish different Frames by the base unit of stream medium data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210166973.3A CN102752193B (en) | 2012-05-23 | 2012-05-23 | A kind of fast cache method of live TV stream |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210166973.3A CN102752193B (en) | 2012-05-23 | 2012-05-23 | A kind of fast cache method of live TV stream |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102752193A CN102752193A (en) | 2012-10-24 |
CN102752193B true CN102752193B (en) | 2015-07-29 |
Family
ID=47032097
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210166973.3A Expired - Fee Related CN102752193B (en) | 2012-05-23 | 2012-05-23 | A kind of fast cache method of live TV stream |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102752193B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103096131B (en) * | 2013-02-06 | 2016-06-08 | 天脉聚源(北京)传媒科技有限公司 | A kind of live method for stream processing and device |
CN110996057B (en) * | 2019-12-02 | 2021-11-16 | 腾讯云计算(北京)有限责任公司 | Media data processing method and device, computer equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101022628A (en) * | 2007-03-21 | 2007-08-22 | 中兴通讯股份有限公司 | Mobile multimedia broadcasting terminal and method for obtaining service allocation list by the same terminal |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006518127A (en) * | 2003-02-18 | 2006-08-03 | ノキア コーポレイション | Picture decoding method |
-
2012
- 2012-05-23 CN CN201210166973.3A patent/CN102752193B/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101022628A (en) * | 2007-03-21 | 2007-08-22 | 中兴通讯股份有限公司 | Mobile multimedia broadcasting terminal and method for obtaining service allocation list by the same terminal |
Also Published As
Publication number | Publication date |
---|---|
CN102752193A (en) | 2012-10-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11303970B2 (en) | Systems and methods for internet video delivery | |
KR101629338B1 (en) | Just-in-time distributed video cache | |
US10986387B1 (en) | Content management for a distributed cache of a wireless mesh network | |
US20170149860A1 (en) | Partial prefetching of indexed content | |
US10305947B2 (en) | Pre-buffering audio streams | |
EP2409241B1 (en) | Dynamic variable rate media delivery system | |
US20160189752A1 (en) | Constrained system real-time capture and editing of video | |
US8219711B2 (en) | Dynamic variable rate media delivery system | |
US10313626B2 (en) | Techniques and system for multiple display media presentations | |
US11758203B2 (en) | Adaptive bitrate video cache | |
US10880357B2 (en) | Reducing requests for media segments in streaming of multimedia content | |
CN103024593A (en) | Online VOD (video on demand) acceleration system and online VOD playing method | |
WO2009143741A1 (en) | Method, system and apparatus for playing media files on demand | |
BR112014000597B1 (en) | METHOD AND SYSTEM FOR DOWNLOADING A MULTIMEDIA FILE | |
CN102438004B (en) | Method and system for acquiring metadata information of media file and multimedia player | |
US9027052B2 (en) | System and method for in-stream advertising on an internet connected device | |
US11089103B1 (en) | Content management in a distributed cache of a wireless mesh network | |
CN102387347A (en) | Video storing and instant replay system based on IP (identification of position)-SAN (storage area networking) direct storage technology | |
CN102752193B (en) | A kind of fast cache method of live TV stream | |
Xie et al. | Dynamic threshold based rate adaptation for HTTP live streaming | |
CN103595694A (en) | A stream media playing method, a stream media playing system, and an internal memory server | |
WO2016063161A1 (en) | Partial prefetching of indexed content | |
US20200186878A1 (en) | Efficient Prefetching of Common Video Clips | |
CN111859218B (en) | Data downloading method, device, computer equipment and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20150729 Termination date: 20170523 |