Real-time flow-medium transmission method and system
Technical field
The present invention relates to the streaming media playing field, more particularly, relate to a kind of real-time flow-medium transmission method and system.
Background technology
The stream technology is meant continuous image and acoustic information is put on the Website server after overcompression is handled, watches, listens to while supply playback terminal to download, and do not need whole compressed file is downloaded to the network transmission technology of just playing after the terminal.And Streaming Media is meant the multimedia file of application stream technology in transmission over networks.
As shown in Figure 1, usually, in the media file process on playback terminal 13 playing networks, be cached to the buffering area of playback terminal 13 from the Streaming Media of media server 12.After the data volume of the buffering area of playback terminal 13 reached the level of setting, playback terminal 13 started decoding with at television set 11 playing stream media files.After starting decoding, on one side playback terminal 13 beginnings on one side buffer memorys decode, promptly receive and the stream medium data of buffer memory from media server 12 in, the stream medium data that playback terminal 13 orders are decoded and downloaded in the buffer area, and on television set 11, playing.Generally speaking, the speed that playback terminal 13 carries out buffer memory equates with the speed of decoding, thereby makes the data volume of buffering area keep constant relatively (promptly maintaining the normal data amount).
Because in existing Play System, the speed that cushions under the normal condition equates with the speed of decoding, if but shake or time delay appear in network, and the speed that will occur cushioning is less than the speed of decoding, thereby causes the data volume decline of buffering area.May occur buffer underflow (not having media data or data volume to be lower than lower limit in the buffering area) thus, playback terminal will suspend decoding and play, and it is normal that the data volume in pending buffer district is recovered, and recovers then to play.Therefore, existing Play System unstable networks when (obstruction, shake or time delay for example occurring) broadcasting pictures can occur pausing, cause playing not smooth, have a strong impact on the result of broadcast of terminal.
Summary of the invention
The technical problem to be solved in the present invention is, the defective that the stream media play system play quality descends during at the above-mentioned unstable networks of prior art provides a kind of real-time flow-medium transmission method and system.
The technical solution adopted for the present invention to solve the technical problems is: construct a kind of real-time flow-medium transmission method, may further comprise the steps:
(a) media server transmission rate information according to described playback terminal when the playback terminal buffer area data volume is unusual changes the speed that sends data to playback terminal;
(b) described media server recovers normal transmission rate when the playback terminal buffer area data volume returns to the normal data amount.
In real-time flow-medium transmission method of the present invention, comprise that also playback terminal begins data in the decoding buffer zone during more than or equal to first threshold at buffer area data volume, and stopping data in the decoding buffer zone during less than first threshold at the playback terminal buffer area data volume, described first threshold is less than buffering area normal data amount.
In real-time flow-medium transmission method of the present invention, in step (a), described media server described playback terminal buffer area data volume during less than second threshold value to be higher than second rate sending data of normal speed, described second threshold value is less than buffering area normal data amount.
In real-time flow-medium transmission method of the present invention, in step (a), in step (a), described media server sends the step of data during greater than the 3rd threshold value at described playback terminal buffer area data volume with the third speed that is lower than normal speed, described the 3rd threshold value is greater than buffering area normal data amount.
In real-time flow-medium transmission method of the present invention, further comprising the steps of:
Media server begins in the decoding buffer zone to send data with the first rate that is higher than normal speed before the data at playback terminal, playback terminal with the metadata cache that receives to its buffering area;
Data in decoding buffer zone when playback terminal reaches first threshold at its buffer area data volume, simultaneously with the 4th rate sending data that is higher than normal speed and is lower than first rate to playback terminal;
Media server sends data to playback terminal with normal speed when the buffer area data volume of playback terminal reaches the normal data amount.
In real-time flow-medium transmission method of the present invention, in step (a) with (b), media server changes the speed that sends data by the rate parameter in the RTSP request of playback terminal.
In real-time flow-medium transmission method of the present invention, in step (a) with (b), media server is according to data volume and determination data transmission rate in the state judgement playback terminal buffering area of playback terminal time-triggered report.
The present invention also provides a kind of real time flow medium transmission system, comprise interconnective playback terminal and media server, described playback terminal has the buffering area of a buffer memory from the media server data, include in the described media server and adjust the speed adjusting module that media server sends data rate, described speed adjusting module transmission rate information according to described playback terminal when the playback terminal buffer area data volume is unusual changes the speed that sends data to described playback terminal, and when returning to the normal data amount, the playback terminal buffer area data volume sends data with normal speed.
In real time flow medium transmission system of the present invention, described speed adjusting module the playback terminal buffer area data volume during less than second threshold value with second rate sending data that is higher than normal speed and when the playback terminal buffer area data volume returns to the normal data amount, send data with normal speed, described second threshold value is less than buffering area normal data amount.
In real time flow medium transmission system of the present invention, described speed adjusting module sends data and send data with normal speed when the playback terminal buffer area data volume returns to the normal data amount with the third speed that is lower than normal speed during greater than the 3rd threshold value at the playback terminal buffer area data volume, and described the 3rd threshold value is greater than buffering area normal data amount.
In real time flow medium transmission system of the present invention, described speed adjusting module changes the speed that sends data by the rate parameter in the RTSP request of playback terminal.
In real time flow medium transmission system of the present invention, described speed adjusting module is according to data volume and determination data transmission rate in the state judgement playback terminal buffering area of playback terminal time-triggered report.
Real-time flow-medium transmission method of the present invention and system change the data transmission rate of media server end according to the data volume of buffering area, guarantee the play quality when unstable networks.The present invention also by the flow control in the caching mechanism realization broadcast start-up course, realizes starting fast, reduces the time of user's wait when cushioning.
Description of drawings
The invention will be further described below in conjunction with drawings and Examples, in the accompanying drawing:
Fig. 1 is the schematic diagram of existing playback terminal buffering and decoding;
Fig. 2 is the media server of real time flow medium transmission system of the present invention and the connection layout of playback terminal;
Fig. 3 is amount of buffered data and time relation figure in the real-time flow-medium transmission method of the present invention;
Fig. 4 is amount of buffered data and the time relation figure when starting fast in the real-time flow-medium transmission method of the present invention;
Fig. 5 is the flow chart of first embodiment of real-time flow-medium transmission method of the present invention;
Fig. 6 is the flow chart of second embodiment of real-time flow-medium transmission method of the present invention.
Embodiment
As shown in Figure 2, be the media server of real time flow medium transmission system of the present invention and the connection layout of playback terminal.In carrying out the streaming media playing process, playback terminal 13 intercoms by RTSP (RealTime Streaming Protocol, real time flow medium host-host protocol) mutually with media server 12.Playback terminal 13 sends the RTSP request to media server 12.In the present embodiment, comprise the speed that request media server 12 is given out a contract for a project in this RTSP request.Media server 12 sends media datas with playback terminal 13 rate request to playback terminal 13 after playback terminal 13 returns RTSP and replys.
In addition, also can judge whether to need to adjust data traffic according to status report (RTCP) by media server 12 from playback terminal 13 timed sending.
In the present embodiment, media server 12 is adjusted the speed that media server 12 sends data by a speed adjusting module (not shown), and this speed adjusting module changes to the speed of playback terminal 13 transmission data when playback terminal 13 buffer area data volumes are unusual and send data with normal speed when playback terminal 13 buffer area data volumes return to the normal data amount.
In the present embodiment, the speed adjusting module playback terminal 13 buffer area data volumes during less than second threshold value to be higher than second rate sending data of normal speed, wherein second threshold value is less than buffering area normal data amount; The speed adjusting module sends data with the third speed that is lower than normal speed at playback terminal 13 buffer area data volumes during greater than the 3rd threshold value, and wherein the 3rd threshold value is greater than buffering area normal data amount.
Rate parameter in the RTSP request of this speed adjusting module by playback terminal changes the speed that sends data, perhaps judges that according to the state of playback terminal time-triggered report data volume in the playback terminal buffering area is with the determination data transmission rate.
As shown in Figure 3, be amount of buffered data and time relation figure in the real-time flow-medium transmission method of the present invention.In the figure, transverse axis express time, the longitudinal axis are represented the data volume of buffer area.
While is in conjunction with the flow chart of the first embodiment of the present invention of Fig. 5, under normal circumstances, the decode rate of playback terminal 13 and buffering speed equate, the time period that 0-T1 as shown in Figure 3 and T3 are later, and the data volume in the buffering area of playback terminal 13 is in normal level (being Lnormal), and this moment, the speed of media server 12 transmission data was normal speed (step S51).
At the T1 time point, network occurs unusual (shake or time delay), and the speed that causes receiving data from playback terminal 13 from network reduces, thus the speed of playback terminal 13 bufferings less than the speed of decoding, so the data volume of buffering area reduces gradually.
When the data volume in the buffering area of playback terminal 13 during less than second threshold value (i.e. Lwarning among the figure), promptly at T2 time point (step S52), playback terminal 13 sends the RTSP request to media server 12, request media server 12 is brought up to second speed with transmission rate, this second speed is greater than normal speed, thereby the receiving velocity of playback terminal 13 is increased.The request of media server 12 response playback terminals 13 sends media data with second speed.The speed of playback terminal 13 buffer memorys is greater than the decode rate of playback terminal 13, thereby the data volume of buffer area rises gradually (step S53) at this moment.
When the data volume of buffering area is recovered just often, promptly at T3 time point (step S54), the RTSP request that playback terminal 13 sends to media server 12, the transmission rate of request media server 12 reverts to normal speed.The request of media server 12 response playback terminals 13 sends media data with normal speed at this moment.
If continue to descend owing to reasons such as network interruption cause buffer area data volume, and drop to below the first threshold (Lmin as shown in the figure), then playback terminal 13 stops decoding, reaches first threshold up to buffer area data volume and restarts decoding.
Similarly, when (not shown) on sometime, when buffer area data volume reaches the 3rd threshold value (being Lmax), playback terminal 13 sends the RTSP request to media server 12, request media server 12 transforms to third speed with transmission rate, this third speed is less than normal speed, thereby the receiving velocity of playback terminal 13 is reduced.This moment playback terminal 13 buffer memorys speed less than the decode rate of playback terminal 13, thereby the data volume of buffer area descends gradually.Recover just often when the data volume of buffering area, playback terminal 13 is asked to the RTSP that media server 12 sends, and the transmission rate of request media server 12 reverts to normal speed.
Above-mentioned first threshold (Lmin), second threshold value (Lwarning), the 3rd threshold value (Lmax) can be set on normal data amount (Lnormal) basis.The fluctuation of supposing buffering capacity is less than 20%, and the buffering area of playback terminal is 10M, then:
Lmax=10M×(1—20%)=8M;
Lnormal=Lmax×(1—20%)=6.4M;
Lwarning=Lnormal×(1—20%)=5.12M;
Lmin is for guarantee allowing the needed minimum buffering capacity of decoding, and this value is relevant with concrete media formats, but generally very little, for example less than 1%, i.e. and Lmin=10M * 1%=0.1M.
Above-mentioned real-time flow-medium transmission method also can be applicable to streaming media playing the startup stage, realize the quick startup of streaming media playing.As shown in Figure 4, be amount of buffered data and time relation figure when starting fast in the real-time flow-medium transmission method of the present invention.In the figure, transverse axis express time, the longitudinal axis are represented the data volume of buffer area.
While is in conjunction with the flow chart of the second embodiment of the present invention of Fig. 6, at starting point (promptly 0 constantly), playback terminal 13 request media servers 12 send data with first rate to playback terminal 13, this first rate during greater than cushioning balance media server 12 send the speed of data.This moment, playback terminal began buffered data, but do not decode (step S61).0~T1 time period buffer area data volume increases fast, and the data in buffering area reach first threshold (being Lmin).
At the T1 time point, the data in judging buffering area reach first threshold (step S62), and playback terminal 13 begins the data in the decoding buffer zone successively, to display device output audio and video; Simultaneously, playback terminal 13 sends the RTSP request to media server 12, and the request media server is with greater than normal speed and less than the 4th rate sending data of above-mentioned first rate, the data volume in buffer area reaches normal data amount (Lnormal).The request of media server 12 response playback terminals 13 sends media data (step S63) with the 4th speed to playback terminal 13.
When the buffer area data volume of judging playback terminal 13 reaches normal level (Lnormal) (step S64), playback terminal 13 makes media server 12 send data with normal speed by the RTSP request, make buffered data identical, thereby make the data volume in the buffer area keep normal data amount (Lnormal) (step S65) with the speed of decoded data.
After starting fast, under the network normal condition, the buffer area data volume of playback terminal 13 fluctuates near normal data amount (Lnormal).
In above-mentioned first embodiment and second embodiment, the change that media server 12 sends data rate can send the RTSP request realization that has request rate by playback terminal 13, also can judge whether to adjust data traffic by the status report (RTCP) of media server 12 from playback terminal 13 timed sending.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.