CN102664806A - Streaming media distribution method and device - Google Patents

Streaming media distribution method and device Download PDF

Info

Publication number
CN102664806A
CN102664806A CN2012101258581A CN201210125858A CN102664806A CN 102664806 A CN102664806 A CN 102664806A CN 2012101258581 A CN2012101258581 A CN 2012101258581A CN 201210125858 A CN201210125858 A CN 201210125858A CN 102664806 A CN102664806 A CN 102664806A
Authority
CN
China
Prior art keywords
flow
source
index
course
judges whether
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.)
Pending
Application number
CN2012101258581A
Other languages
Chinese (zh)
Inventor
张洪燕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CHONGQING WANGLI SHIJIE TECHNOLOGY Co Ltd
Original Assignee
CHONGQING WANGLI SHIJIE TECHNOLOGY Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by CHONGQING WANGLI SHIJIE TECHNOLOGY Co Ltd filed Critical CHONGQING WANGLI SHIJIE TECHNOLOGY Co Ltd
Priority to CN2012101258581A priority Critical patent/CN102664806A/en
Publication of CN102664806A publication Critical patent/CN102664806A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention discloses a streaming media distribution method and a device, which are invented aiming at the defects that in the prior art, the distribution efficiency is low, and other target streams are affected when one path of target stream is abnormal. The method comprises the following steps of: step S101, judging whether a source stream is created or not, if not, turning to a step S201, and if yes, turning to a step S301; step S201, creating the source stream, and turning to the step S301; step S301, creating a target stream; step S401, adding the source stream to the target stream; step S501, distributing the target stream; step S601, stopping the distribution after the target stream receives a command; step S701, deleting the target stream through the source stream; step S801, destroying the target stream; step S901, judging whether the target stream in the source stream is deleted or not, if yes, turning to a step S1001, and if not, finishing the process; and step S1001, destroying the source stream, and finishing the process.

Description

A kind of Streaming Media distribution method and device
Technical field
The present invention relates to the wireless data transmission field, particularly a kind of Streaming Media distribution method and device.
Background technology
When at present Streaming Media being transmitted, generally all can distribute Streaming Media with certain method.Mainly contain two kinds of forms during distribution, a kind of form is that the object flow that the source and course with unicast protocol converts multicast protocol into is distributed, so this kind method needs route the support of multicast to be mainly used in the distribution of local area network (LAN).Second kind of form is that forwarding server uses unicast protocol to distribute into the multichannel object flow the multiplexing back of source and course.This method needs forwarding server to take certain method to carry out multiplexing to source and course.Mobile headend equipment generally all adopts wide area network and server to carry out communication, so second kind of form will be mainly taked in the distribution of mobile flow medium.The performing step of this distribution form is mainly: each source and course is created the formation of a source and course buffering area; For a buffer size threshold value is set in formation; The source produces judges that whether these data add behind buffering area the threshold value above buffering area after the data; If do not surpass then data write this buffering area formation; Otherwise most advanced data of going into formation in the buffering area formation are taken out and deletion; Up to the new data that can in formation, add the generation of current source, and buffer size is no more than till the threshold value of setting, and the new data that then source is produced writes the buffering area formation.
Object flow can adopt two kinds of strategies to the use of source buffering area, strategy 1: whether data are arranged in the detection resources streambuf, if having then get into b, detect if get into a after not waiting for a period of time once more; From the source and course buffering area, take out and get into the data in the source and course buffering area at first, get into c; Each object flow of data that takes out uses successively, and all object flows are used to complete the back and get into d; These data are deleted, get into a.Strategy 2: for each object flow is also created a buffering area formation; Whether data are arranged, if get into a once more after b does not wait for a period of time and detect in the detection resources streambuf if having then get into; From the source and course buffering area, take out and get into the data in the source and course buffering area at first, get into d; To take out data and duplicate n part, and add the formation of object flow buffering area respectively, and need not to wait for to get into e, later object flow uses data directly from the buffer queue of oneself, to read; These data are deleted, get into a.
Have only portion for tactful 1 source data, committed memory is few, realizes simple.Drawback is crossed and is waited slowly unusually for network congestion or processing speed appear in one road object flow wherein, causes the source buffer data too much, flow data will occur to lose, in case the data of all object flows of loss of data all will be lost.Promptly one road object flow occurs will influencing other object flows unusually.So the loss of data that the source buffering area causes inadequately can not occur for strategy 2 basically because the reproduction speed of data generally exceeds a plurality of orders of magnitude than source data generation speed, efficient will reduce but the copy of data and repeated storage will make distribution.
Therefore, prior art exists distribution efficient low, and it is many to take resource, and the defective of other object flows appears influencing unusually in one road object flow.
Summary of the invention
The technical problem that the present invention will solve provides a kind of Streaming Media distribution method and device.
In order to solve the problems of the technologies described above, the invention provides a kind of Streaming Media distribution method, may further comprise the steps:
Step S101 judges whether source and course is created,
If do not create, change step S201; If create, change step S301,
Step S201 creates source and course, changes step 301,
Step S301 creates object flow,
Step S401 is added into this object flow with said source and course,
Step S501, this object flow is distributed,
Step S601, this object flow receives indication, stops distribution,
Step S701, said this object flow of source and course deletion,
Step S801 destroys this object flow,
Step S901 judges whether all object flows are deleted in the said source and course,
If delete, change step S1001; If not deletion, flow process finishes,
Step S1001 destroys said source and course, and flow process finishes.
Further, above-mentioned implementation method also can have following characteristics:
Step S2011, receiving data stream,
Step S2012 judges whether this data flow can generate flow,
If can generate flow, change step S2013; If can not generate flow, change step S2011,
Step S2013, cleaning stream buffer queue,
Step S2014 should flow buffer queue with said flow adding,
Step S2015, notification target stream has new flow to produce, and changes step S2011.
Further, above-mentioned implementation method also can have following characteristics:
Step S20131 judges that the first flow of this buffer queue could delete immediately,
If can delete immediately, change step S20132; If can not delete immediately, change step S20134,
Step S20132 deletes the first flow of this buffer queue,
Step S20133 judges whether current flow buffer queue is empty,
If be not empty, change step S20131; If be empty, flow process finishes,
Step S20134 judges whether this buffer queue flow quantity surpasses threshold value,
If surpass threshold value, change step S20135; If do not surpass threshold value, flow process finishes,
Step S20135 judges whether deletion flow number is zero, and whether current flow is key frame,
If deletion flow number is non-vanishing, and current flow is key frame, and flow process finishes; Other states change step S20136,
Step S20136 judges whether read lock of current flow,
If current flow read lock is changeed step S20137; If the non-read lock of current flow is changeed step S20139,
Step S20137 removes interpolation with flow from this buffer queue and advances delayed deletion flow formation, changes step S20138,
Step S20139 deletes flow immediately, changes step S20138,
Step S20138 judges whether current flow buffer queue is empty,
If be not empty, change step S20135; If be empty, flow process finishes.
Further, above-mentioned implementation method also can have following characteristics:
Step S4011 judges whether key frame is arranged in the flow buffering area,
If key frame is arranged, change step S4013; If there is not key frame, change step S4012,
Step S4012 waits for that key frame generates or the request key frame, changes step S4011,
Step S4013 reads the residue numeration with the key frame flow that gets into buffering area at last and flow thereafter and adds 1,
Step S4014 adds source and course object flow information chained list with this object flow,
Step S4015, the flow index of this object flow is set to the index of this key frame flow.
Further, above-mentioned implementation method also can have following characteristics:
Step S6011, the call number of searching object flow,
Step S6012 judges the object flow call number whether in flow formation call number effective range,
If in effective range, change step S6014; If not in effective range, change step S6013,
Step S6013, all flows in this flow queue after this call number are read the residue numeration and are subtracted 1,
Step S6014 is with information deletion in this object flow information list.
Further, above-mentioned implementation method also can have following characteristics:
Step S5011 judges whether last task finishes,
If finish, change step S5012; If do not finish, flow process finishes,
Step S5012 delivers one and handles the flow task,
Step S5013 handles the flow task and reads flow to the source and course application,
Step S5014 judges whether application is successful,
If step S5015 is changeed in not success; If step S5016 is changeed in success,
Step S5015, it is that previous task has been accomplished that this object flow is set,
Step S5016 uses flow,
Step S5017, read lock is removed in flow.
Further, above-mentioned implementation method also can have following characteristics:
Step S50131 judges whether object flow has locked a flow,
If step S50132 is changeed in not locking; If lock, return the application failure, flow process finishes,
Step S50132 searches the corresponding flow index of object flow,
Step S50133 judges whether the flow index equals current flow queue index maximum and add 1,
If be not equal to, change step S50134; If equal, return the application failure, flow process finishes,
Step S50134 judges whether the flow index is effective index,
If be not effective index, change step S50135; If be effective index, change step S50136,
Step S50135 is current flow queue index minimum value with the flow index modification,
Step S50136 adds 1 with the flow read lock of corresponding flow index in the flow queue, and flow of this target lock-on is set,
Step S50137 returns success the flow of locking.
Further, above-mentioned implementation method also can have following characteristics:
Step S50171 judges whether object flow has locked a flow,
If object flow is locked, change step S50172; If non-locking, flow process finishes,
Step S50172 searches the corresponding flow index of object flow,
Step S50173 judges manipulative indexing whether in flow queue,
If in flow queue, change step S50174; If not in flow queue, change step S50175,
Step S50174, the numeration of flow read lock subtracts 1, and flow is read the residue numeration and is subtracted 1, and the flow index of object flow adds 1, and the flow of object flow non-locking is set,
Step S50175 judges whether in the delayed deletion flow queue,
If in formation, change step S50176; If not in formation, return error message, flow process finishes,
Step S50176, the numeration of flow read lock subtracts 1,
Step S50177 judges whether the flow read lock is 0,
If be 0, change step S50178; If be not 0, change step S50179,
Step S50178, step S50179 is changeed in the deletion flow,
Step S50179, the flow index of object flow adds 1, and the flow of object flow non-locking is set.
Further, above-mentioned implementation method also can have following characteristics:
Said flow also comprises sheet information, and said information comprises stream type, key frame sign, reads the locking numeration and reads the residue numeration.
The invention provides a kind of Streaming Media dispensing device, comprise source and course module and object flow module,
Said source and course module is used for receiving stream-oriented data, and said flow data is carried out burst, and cleaning flow buffer queue adds said flow buffer queue with said flow, notifies said object flow module to have new flow to generate, and sends new task to said object flow module,
Said object flow module is used to judge whether last task disposes, and receives said flow to the application of said source and course module, uses said flow.
By on can know that the inventive method and device reach and occur between the object flow with identical source and course being independent of each other after unusual, quick-recovery soon appears unusually in object flow, improves the technique effect of distributing efficient.
Description of drawings
Fig. 1 is the Streaming Media structural representation of the present invention's one preferred embodiment,
Fig. 2 is the Streaming Media distribution flow sketch map of the present invention's one preferred embodiment,
Fig. 3 is the source and course schematic flow sheet of the present invention's one preferred embodiment,
Fig. 4 is the stream buffer queue clean-up process sketch map of the present invention's one preferred embodiment,
Fig. 5 is that the source and course of the present invention's one preferred embodiment adds an object flow schematic flow sheet,
Fig. 6 is object flow schematic flow sheet of source and course deletion of the present invention's one preferred embodiment,
Fig. 7 is the object flow schematic flow sheet of the present invention's one preferred embodiment,
Fig. 8 is the source and course read lock object flow flow schematic flow sheet of the present invention's one preferred embodiment,
Fig. 9 is the source and course release object flow flow schematic flow sheet of the present invention's one preferred embodiment,
Figure 10 is the Streaming Media dispensing device structural representation of the present invention's one preferred embodiment.
Embodiment
Below in conjunction with accompanying drawing and preferred embodiment, to its concrete grammar that proposes according to the present invention, specify as after.
General thought of the present invention is the Streaming Media distribution method:
Stream data is carried out burst, and preferable video flowing is taked every frame branch a slice, and audio stream uses the data of corresponding time span to be a slice; Flow data behind the burst has the sheet information of a correspondence; The stream type that comprises this sheet; Key frame whether reads locking numeration (current be locked the numeration of using and not using, be initialized as 0); Read residue numeration (current needs are used but the numeration that also is not used, are initialized as object flow quantity); Flow data behind the burst is formed a flow with corresponding sheet information;
The object that generates flow is called source and course, the object that uses flow is called object flow;
Carry out related with the source and course object a plurality of object flow objects;
Carry out association back source and course and object flow and will more independently carry out work;
Source and course only is responsible for the cleaning of flow buffering area, the interpolation of object flow and deletion, and the generation of flow, notice needs notification received object flow when having new flow to generate.
When object flow only is responsible for receiving the notice of new flow generation; The original flow of all these object flows in the streambuf is used in locking successively; After in buffering, not having the original flow of this object flow, this object flow is set to need to receive new flow generates notice.
The method that source and course cleaning flow buffer queue adopts does; At first all are read locking numeration and read the residue numeration and be 0 flow and delete immediately; Can judge that with next to exist object flow to handle flow unusual if fail still after the deletion that flow quantity is dropped to threshold value, the flow that need to get into buffering area at first this moment judges, is that 0 carrying out deleted immediately if read that locking counts; If read locking numeration and be not 0 the delayed deletion that carries out, up to running into key frame.The flow of delayed deletion is deleted after being used to complete reading immediately.This cleaning flow buffer queue method can guarantee that buffering area data can not occur and exceed pre-set threshold; And can let and unusual object flow occurs; Directly get access to key frame when obtain flow next time, can be under the lost part data conditions fast quick-recovery.
Source and course adds mark stream to order; The flow that in the flow buffering area, to search last entering buffering area when adding an object flow be key frame; Add 1 if exist then the residue numeration is read in the flow that this key frame and back thereof get into buffering area, and the object flow that notice has just added there is new flow to generate.If what just increase all later flows no key frame flow in the buffer queue then need wait until has key frame to generate in the source and course after reads residue numeration and the related object flow of notice.Need check whether there is this object flow in the source and course buffering area when deleting an object flow, untapped flow subtracts the residue numeration of reading of these flows 1 and then this object flow is deleted from source and course if exist then need.
The method that the generation of source and course flow is adopted does, has flow data to generate stream is carried out burst, and preferable video flowing is taked every frame branch a slice, and audio stream uses the data of corresponding time span to be a slice; Flow data behind the burst has the sheet information of a correspondence; The stream type that comprises this sheet; Key frame whether reads locking numeration (current be locked the numeration of using and not using, be initialized as 0); Read residue numeration (current needs are used but the numeration that also is not used, are initialized as object flow quantity); Flow data behind the burst is formed a flow with corresponding sheet information, flow is write the flow buffer queue of source and course.
Notice needed the method for notification received object flow to do when source and course had new flow to generate, and generated as new flow, behind the adding flow buffering area, promptly judged the object flow that needs notice, the knowledge that works of going forward side by side.
Source and course is received after the locking of object flow reads the request of a flow; At first search the corresponding flow index value of this object flow; Add 1 then return the locking failure if obtain index value behind the flow index value and be the index maximum of current flow buffer queue; If not judging then whether index value is the valid value range of flow queue; In valid value range, do not need this index to be set to the first index of formation, return this flow after the read lock numeration of then that index is corresponding flow adds 1 and use to object flow.
After source and course is received the request of a flow of an object flow unlocked; At first search the corresponding flow index value of this object flow; Corresponding flow index in flow queue then the numeration of the read lock of flow and read the residue numeration all subtract 1 then this flow index value add 1, accomplish and separate read lock; If the corresponding flow of index value is not in flow queue; Then in delayed deletion flow formation, search; Search less than then making a mistake; After finding the numeration of the read lock of this flow is subtracted 1,, the flow index value of this object flow is added 1 accomplish the flow unlocked if the read lock of flow is decided to be 0 then with this flow deletion.
Object flow receives after source and course has the notice that flow generates; The flow that generates at first that this object flow in the source and course buffering area was not read locks use; The residue numeration of reading to flow after being used to complete subtracts 1 operation; Then next flow is locked use, in buffering area, do not need then this object flow to be set to when source and course has new flow to produce, need notify till the flow that this object flow need read.
The Streaming Media dispensing device:
The source and course object, to the streambuf management of origin, the association of object flow is related with cancellation; The generation of flow; Notice needs notification received object flow when having new flow to generate, and four interface: AddTarget (Target* ptarget) DelTarget (Target* ptarget) externally is provided, LockReadOneSlice (Target* ptarget); Interpolation object flow in the corresponding distribution method of UnlockReadOneSlice (Target* ptarget) difference; The deletion object flow, flow, release flow are read in locking.
The object flow object; When receiving the notice of new flow generation; The original flow of all these object flows in the streambuf is used in locking successively, in buffering, after the original flow of this object flow of nothing, this object flow is set to need to receive new flow generates notice.To the outside interface NewSliceReady () who notifies it to have new flow to generate only is provided.The new flow notice of the acceptance of corresponding object flow.
Task pool is the flow generation of source and course, and the flow of object flow is used, and mission thread is provided.It is PushTask (ITask* ptask) that interface externally is provided
Preferable said source and course object comprises:
The flow buffer queue cushions preservation to the flow that generates; Source and course will call the NewSliceReady () interface of all object flows related with this source and course when new flow gets into buffer queue.
The object flow information chained list, the information of preserving all object flows comprises the call number of next this flow of reading of each object flow, after generating, new flow whether notifies, and the interface IP address of notice.
Preferable; When object flow receives the notice of new flow generation; To task of task pool application, this task is read a flow through LockReadOneSlice (Target* ptarget) interface locks of calling source and course at once, when the read lock success is then used this flow; The UnlockReadOneSlice (Target* ptarget) that calls source and course after being used to complete unlocks, then at once once more to identical task of task pool application.Read a flow failure up to task to the source and course locking, this object flow then is set receives the notice that new flow produces once more, wait for the arrival that next new flow produces notice.
NewSliceReady () interface notification target stream through Target when source and course has new flow to generate has new flow to generate.
The Streaming Media structural representation of the present invention's one preferred embodiment is referring to Fig. 1; A source and course comprises an object flow information chained list; This chained list comprises that all add the object flow information of this source and course to and (whether locked and read a flow; Read or read the call number of flow next time, the flow of object flow generates notification interface); A flow buffer queue, that cushions in the buffer queue is up-to-date flow data (comprise whether flow is key frame, the type of flow, the call number of flow, residue numeration, flow data are read in the numeration of flow read lock, flow); With a delayed deletion flow chained list, when having abnormal conditions to take place in the object flow, the flow meeting that do not run through of stream buffer queue exceeds buffer threshold; To delete this moment to the most outmoded flow, and the outmoded flow when discovery need be deleted has object flow when reading not release, need carry out delayed deletion; All need the flow of delayed deletion all will get into this chained list; The flow that gets into this chained list can't be read by other object flows lockings later on, unlock only, and release is deleted after accomplishing again.
The Streaming Media distribution flow sketch map of the present invention's one preferred embodiment is referring to Fig. 2, and step S101 judges whether source and course is created, if do not create, changes step S201; If create, change step S301, step S201 creates source and course, changes step 301, step S301; Create object flow, step S401 is added into this object flow with said source and course, step S501, and this object flow is distributed, step S601; This object flow receives indication, stops distribution, step S701, said this object flow of source and course deletion, step S801; Destroy this object flow, step S901 judges whether all object flows are deleted in the said source and course, if delete, changes step S1001; If not deletion, flow process finishes, and step S1001 destroys said source and course, and flow process finishes.
The source and course schematic flow sheet of the present invention's one preferred embodiment is referring to Fig. 3, step S2011, and receiving data stream, step S2012 judges whether this data flow can generate flow, if can generate flow, changes step S2013; If can not generate flow, change step S2011, step S2013, cleaning stream buffer queue, step S2014 is somebody's turn to do the stream buffer queue with said flow adding, step S2015, notification target stream has new flow to produce, commentaries on classics step S2011.
Source and course begins to receive data after starting; After receiving frame data, can generate a flow; Earlier the flow formation is once cleared up after producing flow,, then buffer queue is put in flow and got final product in case cleaning back formation can be put into a flow certainly once more; Notify all object flows to have new flow to generate after adding successfully, continue to receive data then and repeat said process.
The stream buffer queue clean-up process sketch map of the present invention's one preferred embodiment is referring to Fig. 4, and step S20131 judges that the first flow of this buffer queue could delete immediately, if can delete immediately, changes step S20132; If can not delete immediately, change step S20134, step S20132 deletes the first flow of this buffer queue, and step S20133 judges that whether current flow buffer queue is empty, if be not empty, changes step S20131; If be empty, flow process finishes, and step S20134 judges that whether this buffer queue flow quantity surpasses threshold value, if surpass threshold value, changes step S20135; If surpass threshold value, flow process finishes, and step S20135 judges whether deletion flow number is zero, and whether current flow is key frame, if deletion flow number is non-vanishing, and current flow is key frame, and flow process finishes; Other states change step S20136, judge whether read lock of current flow, if current flow read lock is changeed step S20137; If the non-read lock of current flow is changeed step S20139, step S20137; Flow is removed interpolation from this buffer queue advance delayed deletion flow formation, change step S20138, step S20139; Flow is deleted immediately, change step S20138, step S20138; Judge that whether current flow buffer queue is empty, if be not empty, changes step S20135; If be empty, flow process finishes.Above-mentioned " other states " comprises following several kinds of situation: if deletion flow number is zero, no matter whether current flow is key frame, changes step S20136; If deletion flow number is non-vanishing, and current flow be key frame, commentaries on classics step S20136.
Judging at first when beginning to clear up the flow buffering area whether the most outmoded flow in the formation of flow buffering area has to be read by all object flows finishes and not by read lock; Sure then delete immediately and then carry out above-mentioned same operation; Up to buffer queue for empty or above-mentioned be judged as negative; Negative then whether flow quantity that detect buffer queue buffering surpasses setting threshold; Do not surpass and clean out, speed unusual or that read flow occurs and be lower than the speed that the source produces, at this moment need the Force Deletion flow if surpass then can define an object flow; The Force Deletion flow need be deleted up to running into flow of key frame flow and minimum Force Deletion, then can thinking the most outmoded flow always and cleaned out.It should be noted that when Force Deletion runs into by the flow of read lock and need put it in the delayed deletion flow chained list; Because also had object flow using by the flow of read lock explanation; After being used to complete, just can delete; Flow buffer queue through cleaning is used for placing newly-generated flow with the rarest position.
The source and course of the present invention's one preferred embodiment adds an object flow schematic flow sheet referring to Fig. 5, step S4011, and whether in flow buffering area have key frame, if key frame is arranged, change step S4013 if judging; If there is not key frame, change step S4012, step S4012; Wait for that key frame generates or the request key frame, change step S4011, step S4013; The residue numeration is read in the key frame flow that gets into buffering area at last and flow thereafter add 1, step S4014 adds source and course object flow information chained list with this object flow; Step S4015, the flow index of this object flow is set to the index of this key frame flow.
Flow chart when this flow process is distributed target for needing to increase; When adding an object flow, after obtaining flowing, object flow can decode immediately in order to guarantee; So need give object flow as first flow with the key frame flow; Therefore detect at first in the stream buffer queue whether key frame is arranged; If do not exist then needs wait this object flow earlier and to add the object flow information chained list when relevant key frame generates again, key frame produces or the residue numeration of reading that adds the flow of formation when in the flow formation, having key frame with this flow with this flow after adds 1 respectively by the time, and this is all will add 1 because of the reader who has added flows all behind the object flow; Information with object flow adds the object flow information list then, and the index of the key frame flow that finds is set to the index of this object flow.Accomplish the interpolation of object flow, after object flow adds completion, can obtain notice, and can correct locking read flow and discharge flow in case there is new flow to generate the new object flow that adds.
The source and course of the present invention's one preferred embodiment is deleted an object flow schematic flow sheet referring to Fig. 6, step S6011, the call number of searching object flow; Step S6012; Judge that the object flow call number whether in flow formation call number effective range, if in effective range, changes step S6014; If not in effective range, change step S6013, step S6013, all flows in this flow queue after this call number are read the residue numeration and are subtracted 1, and step S6014 is with information deletion in this object flow information list.
When an object flow no longer needs the source and course data; From source and course this object flow is deleted; Should be noted that in the time of deletion and be exactly; Because the flow of source and course is to think that all object flows all will read this flow in the object flow information when generating, the flow of the object flow that this object flow did not read need be read after the residue numeration subtracts 1 it, the information of this object flow delete promptly to accomplish from the object flow information chained list delete object flow.
The object flow schematic flow sheet of the present invention's one preferred embodiment is referring to Fig. 7, and step S5011 judges whether last task finishes, if finish, changes step S5012; If do not finish, the flow process end, step S5012 delivers one and handles the flow task, and step S5013 handles the flow task and reads flow to the source and course application, and step S5014 judges whether application is successful, if step S5015 is changeed in success; If step S5016 is changeed in success, step S5015, it is that previous task has been accomplished that this object flow is set, step S5016 uses flow, step S5017, read lock is removed in flow.
The object flow back that has notice earlier judges whether previous task is accomplished, and does not accomplish and does not directly withdraw from, if accomplished then deliver a processing flow task; Handle the flow task from flow of flow read lock; Be used to complete the back unlocked then, and then the delivery task, think do not have flow to read up to locking flow failure; This object flow is set to previous task completion needs to receive next new flow generation notice, withdraws from the arrival of waiting for next notice then.
The source and course read lock object flow flow schematic flow sheet of the present invention's one preferred embodiment is referring to Fig. 8, and step S50131 judges whether object flow has locked a flow, if step S50132 is changeed in not locking; If lock, return the application failure, flow process finishes, and step S50132 searches the corresponding flow index of object flow, and step S50133 judges whether the flow index equals current flow queue index maximum and add 1, if be not equal to, changes step S50134; If equal, return the application failure, flow process finishes, and step S50134 judges whether the flow index is effective index, if be not effective index, changes step S50135; If be effective index, change step S50136, step S50135; With the flow index modification is current flow queue index minimum value, and step S50136 adds 1 with the flow read lock of corresponding flow index in the flow queue; Flow of this target lock-on is set, and step S50137 returns success the flow of locking.
When each object flow uses the flow of source and course, all need flow of first read lock, this flow process guarantees that each read lock gets access to such an extent that flow is continuous flow, or a key frame flow.When locking, judge at first whether this object flow had locked a flow, locked and then directly returned the locking failure; The flow index that non-locking is then corresponding with object flow gets access to; Whether the flow index of judging this object flow then is that the maximum of index in the flow buffer queue adds 1; Be then to explain all flows in the flow queue were all read; Return the application failure, object flow is waited for after next flow generates notice and is read flow again; Otherwise judge that the flow index is whether in effective index range of flow queue flow; If the flow index did not all read all flows in the formation at effective range and object flow then can distinguish that flow has taken place lost; Need be set to the index of flow the head of formation this moment; Queue heads is the key frame flow certainly when having guaranteed that by flow buffer queue method for cleaning the generation flow is lost, and at this moment can guarantee to take place unusual object flow quick-recovery soon.Need the locking of flow that should correspondence to read numeration when the flow that index value is corresponding can be found in the flow buffering area and add 1 and this object flow is set has locked a flow, then this flow is returned to object flow, accomplish the locking of reading of flow.
The source and course release object flow flow schematic flow sheet of the present invention's one preferred embodiment is referring to Fig. 9, and step S50171 judges whether object flow has locked a flow, if object flow is locked, changes step S50172; If non-locking, flow process finish, step S50172 searches the corresponding flow index of object flow, and step S50173 judges manipulative indexing whether in flow queue, if in flow queue, and commentaries on classics step S50174; If not in flow queue, change step S50175, step S50174; The numeration of flow read lock subtracts 1, and flow is read the residue numeration and subtracted 1, and the flow index of object flow adds 1; The flow of object flow non-locking is set, and step S50175 judges whether in the delayed deletion flow queue; If in formation, change step S50176; If not in formation, return error message, flow process finishes, step S50176, and the numeration of flow read lock subtracts 1, and step S50177 judges whether the flow read lock is 0, if be 0, changes step S50178; If be not 0, change step S50179, step S50178, step S50179 is changeed in the deletion flow, step S50179, the flow index of object flow adds 1, and the flow of object flow non-locking is set.
When an object flow use oneself the locking flow after; Need read release to this flow, this flow oneself had been read once in the surface, and next time, locking need be read next flow when reading; If release does not begin need to judge whether to have locked a flow not then return mistake; If locked a flow then obtained the index of this object flow, get access to such an extent that index can find corresponding flow in flow queue, then with the read lock numeration of this flow, read to remain that numeration subtracts 1, the flow index of object flow adds 1; The flow of this object flow non-locking is set, promptly accomplishes release; If object flow shifts out buffer queue for needing the flow of release to be forced to the flow release for a long time; Need carry out release to this flow this moment in the delayed deletion chained list, if all releases then also need from the delayed deletion chained list, flow thoroughly to be deleted of all lockings.And then the flow index of this object flow is added 1 the flow of this object flow non-locking is set, accomplish the release of flow.
Flow also comprises sheet information, and sheet information comprises stream type, key frame sign, reads the locking numeration and reads the residue numeration.
The Streaming Media dispensing device structural representation of the present invention's one preferred embodiment comprises source and course module and object flow module referring to Figure 10, and the source and course module is used for receiving stream-oriented data; Said flow data is carried out burst; Cleaning flow buffer queue adds said flow buffer queue with said flow, notifies said object flow module to have new flow to generate; Send new task to said object flow module; The object flow module is used to judge whether last task disposes, and receives said flow to the application of said source and course module, uses said flow.
Above embodiment only is used to explain the present invention, but not is used to limit the present invention.

Claims (10)

1. a Streaming Media distribution method is characterized in that, may further comprise the steps,
Step S101 judges whether source and course is created,
If do not create, change step S201; If create, change step S301,
Step S201 creates source and course, changes step 301,
Step S301 creates object flow,
Step S401 is added into this object flow with said source and course,
Step S501, this object flow is distributed,
Step S601, this object flow receives indication, stops distribution,
Step S701, said this object flow of source and course deletion,
Step S801 destroys this object flow,
Step S901 judges whether all object flows are deleted in the said source and course,
If delete, change step S1001; If not deletion, flow process finishes,
Step S1001 destroys said source and course, and flow process finishes.
2. Streaming Media distribution method according to claim 1 is characterized in that, said step S201 is specially:
Step S2011, receiving data stream,
Step S2012 judges whether this data flow can generate flow,
If can generate flow, change step S2013; If can not generate flow, change step S2011,
Step S2013, cleaning stream buffer queue,
Step S2014 should flow buffer queue with said flow adding,
Step S2015, notification target stream has new flow to produce, and changes step S2011.
3. Streaming Media distribution method according to claim 2 is characterized in that, said step S2013 is specially:
Step S20131 judges that the first flow of this buffer queue could delete immediately,
If can delete immediately, change step S20132; If can not delete immediately, change step S20134,
Step S20132 deletes the first flow of this buffer queue,
Step S20133 judges whether current flow buffer queue is empty,
If be not empty, change step S20131; If be empty, flow process finishes,
Step S20134 judges whether this buffer queue flow quantity surpasses threshold value,
If surpass threshold value, change step S20135; If do not surpass threshold value, flow process finishes,
Step S20135 judges whether deletion flow number is zero, and whether current flow is key frame,
If deletion flow number is non-vanishing, and current flow is key frame, and flow process finishes; Other states change step S20136,
Step S20136 judges whether read lock of current flow,
If current flow read lock is changeed step S20137; If the non-read lock of current flow is changeed step S20139,
Step S20137 removes interpolation with flow from this buffer queue and advances delayed deletion flow formation, changes step S20138,
Step S20139 deletes flow immediately, changes step S20138,
Step S20138 judges whether current flow buffer queue is empty,
If be not empty, change step S20135; If be empty, flow process finishes.
4. Streaming Media distribution method according to claim 1 is characterized in that step S401 is specially:
Step S4011 judges whether key frame is arranged in the flow buffering area,
If key frame is arranged, change step S4013; If there is not key frame, change step S4012,
Step S4012 waits for that key frame generates or the request key frame, changes step S4011,
Step S4013 reads the residue numeration with the key frame flow that gets into buffering area at last and flow thereafter and adds 1,
Step S4014 adds source and course object flow information chained list with this object flow,
Step S4015, the flow index of this object flow is set to the index of this key frame flow.
5. Streaming Media distribution method according to claim 4 is characterized in that step S601 is specially:
Step S6011, the call number of searching object flow,
Step S6012 judges the object flow call number whether in flow formation call number effective range,
If in effective range, change step S6014; If not in effective range, change step S6013,
Step S6013, all flows in this flow queue after this call number are read the residue numeration and are subtracted 1,
Step S6014 is with information deletion in this object flow information list.
6. Streaming Media distribution method according to claim 1 is characterized in that step S501 is specially:
Step S5011 judges whether last task finishes,
If finish, change step S5012; If do not finish, flow process finishes,
Step S5012 delivers one and handles the flow task,
Step S5013 handles the flow task and reads flow to the source and course application,
Step S5014 judges whether application is successful,
If step S5015 is changeed in not success; If step S5016 is changeed in success,
Step S5015, it is that previous task has been accomplished that this object flow is set,
Step S5016 uses flow,
Step S5017, read lock is removed in flow.
7. Streaming Media distribution method according to claim 6 is characterized in that, said step S5013 is specially:
Step S50131 judges whether object flow has locked a flow,
If step S50132 is changeed in not locking; If lock, return the application failure, flow process finishes,
Step S50132 searches the corresponding flow index of object flow,
Step S50133 judges whether the flow index equals current flow queue index maximum and add 1,
If be not equal to, change step S50134; If equal, return the application failure, flow process finishes,
Step S50134 judges whether the flow index is effective index,
If be not effective index, change step S50135; If be effective index, change step S50136,
Step S50135 is current flow queue index minimum value with the flow index modification,
Step S50136 adds 1 with the flow read lock of corresponding flow index in the flow queue, and flow of this target lock-on is set,
Step S50137 returns success the flow of locking.
8. Streaming Media distribution method according to claim 7 is characterized in that, said step S5017 is specially:
Step S50171 judges whether object flow has locked a flow,
If object flow is locked, change step S50172; If non-locking, flow process finishes,
Step S50172 searches the corresponding flow index of object flow,
Step S50173 judges manipulative indexing whether in flow queue,
If in flow queue, change step S50174; If not in flow queue, change step S50175,
Step S50174, the numeration of flow read lock subtracts 1, and flow is read the residue numeration and is subtracted 1, and the flow index of object flow adds 1, and the flow of object flow non-locking is set,
Step S50175 judges whether in the delayed deletion flow queue,
If in formation, change step S50176; If not in formation, return error message, flow process finishes,
Step S50176, the numeration of flow read lock subtracts 1,
Step S50177 judges whether the flow read lock is 0,
If be 0, change step S50178; If be not 0, change step S50179,
Step S50178, step S50179 is changeed in the deletion flow,
Step S50179, the flow index of object flow adds 1, and the flow of object flow non-locking is set.
9. according to any one described Streaming Media distribution method in the claim 1 to 8, it is characterized in that said flow also comprises sheet information, said information comprises stream type, key frame sign, reads the locking numeration and reads the residue numeration.
10. a Streaming Media dispensing device is characterized in that, comprises source and course module and object flow module,
Said source and course module is used for receiving stream-oriented data, and said flow data is carried out burst, and cleaning flow buffer queue adds said flow buffer queue with said flow, notifies said object flow module to have new flow to generate, and sends new task to said object flow module,
Said object flow module is used to judge whether last task disposes, and receives said flow to the application of said source and course module, uses said flow.
CN2012101258581A 2012-04-26 2012-04-26 Streaming media distribution method and device Pending CN102664806A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012101258581A CN102664806A (en) 2012-04-26 2012-04-26 Streaming media distribution method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012101258581A CN102664806A (en) 2012-04-26 2012-04-26 Streaming media distribution method and device

Publications (1)

Publication Number Publication Date
CN102664806A true CN102664806A (en) 2012-09-12

Family

ID=46774224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012101258581A Pending CN102664806A (en) 2012-04-26 2012-04-26 Streaming media distribution method and device

Country Status (1)

Country Link
CN (1) CN102664806A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112055231A (en) * 2020-08-31 2020-12-08 浙江大华技术股份有限公司 Video decoding method, decoding device, decoder and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101068155A (en) * 2006-09-20 2007-11-07 腾讯科技(深圳)有限公司 Coordinate connection stream media direct broadcasting system and collection server thereof
CN101447928A (en) * 2008-12-31 2009-06-03 华为技术有限公司 Method and device for processing fragment information
CN102137278A (en) * 2010-12-30 2011-07-27 广州市动景计算机科技有限公司 System and method for broadcasting and distributing streaming media based on mobile terminal
US20120012561A1 (en) * 2010-07-14 2012-01-19 Illinois Tool Works Inc. Welding parameter control
US20120050616A1 (en) * 2010-08-25 2012-03-01 Telefonaktiebolaget Lm Ericsson (Publ) Controlling streaming media responsive to proximity to user selected display elements

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101068155A (en) * 2006-09-20 2007-11-07 腾讯科技(深圳)有限公司 Coordinate connection stream media direct broadcasting system and collection server thereof
CN101447928A (en) * 2008-12-31 2009-06-03 华为技术有限公司 Method and device for processing fragment information
US20120012561A1 (en) * 2010-07-14 2012-01-19 Illinois Tool Works Inc. Welding parameter control
US20120050616A1 (en) * 2010-08-25 2012-03-01 Telefonaktiebolaget Lm Ericsson (Publ) Controlling streaming media responsive to proximity to user selected display elements
CN102137278A (en) * 2010-12-30 2011-07-27 广州市动景计算机科技有限公司 System and method for broadcasting and distributing streaming media based on mobile terminal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112055231A (en) * 2020-08-31 2020-12-08 浙江大华技术股份有限公司 Video decoding method, decoding device, decoder and electronic equipment
CN112055231B (en) * 2020-08-31 2021-10-15 浙江大华技术股份有限公司 Video decoding method, decoding device, decoder and electronic equipment

Similar Documents

Publication Publication Date Title
KR102039778B1 (en) Method and apparatus for adaptively providing multiple bit rate stream media in server
CN107766129B (en) Task processing method, device and system
Huang et al. Codes can reduce queueing delay in data centers
CN106201771B (en) Data-storage system and data read-write method
US8762604B2 (en) Managing buffer conditions through sorting
US6892199B2 (en) Saving burst data by using semi-merge sorting module
CN106776368A (en) Buffer memory management method, apparatus and system during a kind of digital independent
CN110489484B (en) Data synchronization method and device, readable storage medium and electronic equipment
CN104536699B (en) A kind of stream data wiring method based on embedded file system
CN106708653A (en) Mixed tax administration data security protecting method based on erasure code and multi-copy
Zhao et al. FedPAGE: A fast local stochastic gradient method for communication-efficient federated learning
CN111050188B (en) Data stream scheduling method, system, device and medium
US20110302223A1 (en) Anti-Item for Deletion of Content In A Distributed Datastore
CN102508902A (en) Block size variable data blocking method for cloud storage system
CN106203916A (en) A kind of distributed pickup code generating method
WO2014135011A1 (en) Database system and data synchronization method
CN101068341A (en) Stream media dispatching system and medium file scheduling method thereof
CN102664806A (en) Streaming media distribution method and device
CN109151061B (en) Data storage method and device
WO2012029575A1 (en) Packet transmission control device, packet transmission control method, and program
CN103399943A (en) Communication method and communication device for parallel query of clustered databases
Wang et al. Peer-to-peer asynchronous video streaming using skip list
CN109408477A (en) A kind of method, system and associated component that setting group document is locked
CN103139607A (en) Real-time network monitoring system and method thereof
US9003018B2 (en) System and method for data set synchronization and replication

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120912