Summary of the invention
Problems such as in view of above reason, the present invention aims to provide a kind of online playing video buffering and buffering in advance, and it is slow excessively effectively to solve the time of starting broadcasting, and redirect is corresponding slow excessively, and buffering effect is undesirable, and can effectively utilize user bandwidth.For this reason, the present invention proposes following technical scheme:
A kind of online playing buffer system is made up of preparatory buffer module, video information analysis module, transmit control module and state interactive module, it is characterized in that: above-mentioned preparatory buffer module cushions the audio/video flow that receives in advance; Above-mentioned video information analysis module is analyzed from preparatory buffer module reading video data, obtains the code rate information of each audio/video flow in the video file, and information is passed to the player control module; After transmit control module obtains the audio frequency and video code rate information, the bit stream buffer district of player is provided with, said transmit control module comprises the setting of video code flow buffering area and audio code stream buffering area to the setting in the bit stream buffer district of player; Be provided with after the buffering area, transmit control module starts player; Player is in buffer status after starting, and reading of data from preparatory buffer module is filled video code flow buffering area and audio code stream buffering area.
Said state interactive module is used for carrying out alternately with the user; When transmit control module is sent to the state interactive module with the broadcast state of player; The state interactive module is presented to the user with the state of player, is made operations such as time-out, wait or redirect by the user.
Further, the size of said video code flow buffering area is set to VBuffer=VMaxRate*Time, the big or small ABuffer=AMaxRate*Time of said audio code stream buffering area; Wherein, VBuffer is the size of the video code flow buffering area of player, and said VMaxRate is the maximal rate of video flowing; ABuffer is the size of the audio code stream buffering area of player, and said AMaxRate is the maximal rate of audio stream, and said Time is adjustable time parameter.
Preferably, said Time is 10 seconds.
In the preferred implementation, in buffering course, the state of the code stream of player control module cycle detection player, after the data volume in video or the audio buffer was greater than threshold value S, the player control module was sent the beginning play command to player; Said threshold value S=VMaxRate*0.5S.
Further, after player began to play, the player control module continued the code stream state of cycle detection player; When the data in video or the audio buffer are less than threshold value L; Suspend the broadcast of player, and this incident is sent to the state interactive module, said threshold value L=VMaxRate*1 second; Data in video or audio code stream buffering area are greater than the VBuffer upper limit or MaxBuffer; Perhaps time out overtime threshold value P; Transmit control module notice player is replied broadcast state; And give the state interactive module with this incident, player feeds back to transmit control module with its broadcast state.
The present invention also provides a kind of online way to play for time, may further comprise the steps:
Step 1: buffer module cushions the data that receive in advance in advance, and data are offered the video information analysis module;
Step 2: the video information analysis module is analyzed from preparatory buffer module reading video data.Said analysis content includes but not limited to data content, data bit rate information etc., and said data are audio/video information;
Step 3: the video information analysis module is analyzed video data, obtains the code rate information of each audio/video flow in the video file, and information is passed to the player control module;
Step 4: after transmit control module obtains the audio frequency and video code rate information, the bit stream buffer district of player is provided with, starts player, player is reading of data from preparatory buffer module, fills screen buffer and audio buffer.
One preferred embodiment in, said step 4 comprises:
Step 4-1: with the big or small VBuffer=VMaxRate*Time of the video code flow buffering area of player;
Step 4-2: with the big or small ABuffer=AMaxRate*Time of the audio code stream buffering area of player;
Wherein, VBuffer is the size of the video code flow buffering area of player, and said VMaxRate is the maximal rate of video flowing; ABuffer is the size of the audio code stream buffering area of player, and said AMaxRate is the maximal rate of audio stream, and said Time is adjustable time parameter.
Alternatively; Also comprise after the said step 4: step 5: the state of the code stream of player control module cycle detection player; After the data volume in video or the audio buffer was greater than threshold value S, the player control module was sent the beginning play command to player, and player begins playing audio-video; Said threshold value S=VMaxRate*0.5S.
Further, also comprise after the said step 5:
After player begins to play; The player control module continues the code stream state of cycle detection player, when the data in video or the audio buffer are less than threshold value L, suspends the broadcast of player; And this incident is sent to the state interactive module, said threshold value L=VMaxRate*1 second; Data in video or audio code stream buffering area are greater than the VBuffer upper limit or MaxBuffer; Perhaps time out overtime threshold value P; Transmit control module notice player is replied broadcast state; And give the state interactive module with this incident, player feeds back to transmit control module with its broadcast state.
Technique scheme can effectively be saved Installed System Memory, and can guarantee enough bufferings.As long as just start broadcasting when when just starting broadcasting, guaranteeing the video data of a frame with user's redirect, can effectively reduce user's stand-by period like this, increased user experience.
Embodiment
Below will describe preferred embodiment of the present inventionly, those skilled in the art should be understood that these execution modes and nonrestrictive.In order to address the above problem, concrete implementation provided by the invention is following.
Referring to accompanying drawing 1, the present invention at first provides a kind of online playing buffer system, and this system is made up of preparatory buffer module, video information analysis module, transmit control module and state interactive module.
Above-mentioned preparatory buffer module receives the data that the data reception module (not shown in figure 1) sends over, and the data that receive are cushioned in advance, then data is offered extraneous module and uses, and said data reception module is used for obtaining data from network.
The video information analysis module is analyzed from preparatory buffer module reading video data, analyzes content and includes but not limited to data content, data bit rate information etc.Preferably, said data are audio/video information.After the analysis; The video information analysis module obtains the code rate information of each audio/video flow in the video file; And information passed to the player control module, if some environment is difficult to obtain automatically the code rate information of audio frequency and video down, also can specify through other modes are artificial.
After transmit control module obtains the audio frequency and video code rate information, code stream (bitstream) buffering area of player is provided with.At one preferably in the execution mode, with the big or small VBuffer=VMaxRate*Time of video code flow (bitstream) buffering area of player.Said VBuffer is the size of the video code flow buffering area of player; Said VMaxRate is the maximal rate of video flowing; Said Time is adjustable time parameter, and in the nonrestrictive execution mode, Time is 10 seconds; That is, the video code flow buffering area of player is arranged to the size greater than maximal rate video flowing 10s data.On the other hand, with the big or small ABuffer=AMaxRate*Time of audio code stream (bitstream) buffering area of player.Said ABuffer is the size of the audio code stream buffering area of player; Said AMaxRate is the maximal rate of audio stream; Said Time is adjustable time parameter, and in the nonrestrictive execution mode, Time is 10 seconds; That is, the audio code stream buffering area of player is arranged to the size greater than maximal rate audio stream 10s data.If VMaxRate*Time >=upper limit MaxBuffer of buffering area, then VBuffer=MaxBuffer.
Be provided with after the buffering area, transmit control module starts player.
At first be in buffer status after player starts, and from preparatory buffer module reading of data, fill screen buffer and audio buffer.
In buffering course, the state of the code stream bitstram of player control module cycle detection player, after the data volume in video or the audio buffer was greater than threshold value S, the player control module was sent the beginning play command to player; Preferably, in order to guarantee the continuity of video playback, said threshold value S=VMaxRate*0.5S, that is, and the data of desirable VMaxRate*0.5 second.Likewise, because audio-visual synchronization, the amount of audio data that work as in the audio buffer this moment is AMaxRate*0.5.
Player begins to play, and after beginning broadcast, the player control module continues the code stream state of cycle detection player, when the data in video or the audio buffer are less than threshold value L, suspends the broadcast of player, and this incident is sent to the state interactive module.Preferably, in order to guarantee not occur the repeatedly pause in the playing process, said threshold value L=VMaxRate*1S, that is, and the data of desirable VMaxRate*1 second.On the other hand; Data in video or audio code stream buffering area are greater than the VBuffer upper limit or MaxBuffer; Perhaps time out overtime threshold value P; Transmit control module notice player is replied broadcast state, and gives the state interactive module with this incident, and player feeds back to transmit control module with its broadcast state.Above-mentioned alternatively P=20 second.
The state interactive module is used for carrying out alternately with the user, and when transmit control module was sent to the state interactive module with the broadcast state of player, the state interactive module was presented to the user with the state of player, is made time-out, is waited for or operation such as redirect by the user.When user's redirect, buffering strategy is handled when starting broadcasting.
On the other hand, the present invention also provides a kind of online way to play for time, may further comprise the steps:
Step 1: buffer module cushions the data that receive in advance in advance, and data are offered the video information analysis module.
Step 2: the video information analysis module is analyzed from preparatory buffer module reading video data.Said analysis content includes but not limited to data content, data bit rate information etc.Preferably, said data are audio/video information.
Step 3: after the video information analysis module is analyzed video data; Obtain the code rate information of each audio/video flow in the video file; And information passed to the player control module; If some environment is difficult to obtain automatically the code rate information of audio frequency and video down, also can specify through other modes are artificial.
Step 4: after transmit control module obtains the audio frequency and video code rate information, code stream (bitstream) buffering area of player is provided with.At one preferably in the execution mode, with the big or small VBuffer=VMaxRate*Time of video code flow (bitstream) buffering area of player.Said VBuffer is the size of the video code flow buffering area of player; Said VMaxRate is the maximal rate of video flowing; Said Time is adjustable time parameter, and in the nonrestrictive execution mode, Time is 10 seconds; That is, the video code flow buffering area of player is arranged to the size greater than maximal rate video flowing 10s data.On the other hand, with the big or small ABuffer=AMaxRate*Time of audio code stream (bitstream) buffering area of player.Said ABuffer is the size of the audio code stream buffering area of player; Said AMaxRate is the maximal rate of audio stream; Said Time is adjustable time parameter, and in the nonrestrictive execution mode, Time is 10 seconds; That is, the audio code stream buffering area of player is arranged to the size greater than maximal rate audio stream 10s data.If VMaxRate*Time >=upper limit MaxBuffer of buffering area, then VBuffer=MaxBuffer.
Step 5: transmit control module has been provided with after the buffering area, and transmit control module starts player.At first be in buffer status after player starts, and from preparatory buffer module reading of data, fill screen buffer and audio buffer.
In buffering course, the state of the code stream bitstram of player control module cycle detection player, after the data volume in video or the audio buffer was greater than threshold value S, the player control module was sent the beginning play command to player; Preferably, in order to guarantee the continuity of video playback, said threshold value S=VMaxRate*0.5S, that is, and the data of desirable VMaxRate*0.5 second.Likewise, because audio-visual synchronization, the amount of audio data that work as in the audio buffer this moment is AMaxRate*0.5.
Step 6: player begins to play; After beginning broadcast, the player control module continues the code stream state of cycle detection player, when the data in video or the audio buffer are less than threshold value L; Suspend the broadcast of player, and this incident is sent to the state interactive module.Preferably, in order to guarantee not occur the repeatedly pause in the playing process, said threshold value L=VMaxRate*1S, that is, and the data of desirable VMaxRate*1 second.On the other hand; Data in video or audio code stream buffering area are greater than the VBuffer upper limit or MaxBuffer; Perhaps time out overtime threshold value P; Transmit control module notice player is replied broadcast state, and gives the state interactive module with this incident, and player feeds back to transmit control module with its broadcast state.Above-mentioned alternatively P=20 second.
The state interactive module is used for carrying out alternately with the user, and when transmit control module was sent to the state interactive module with the broadcast state of player, the state interactive module was presented to the user with the state of player, is made time-out, is waited for or operation such as redirect by the user.When user's redirect, buffering strategy is handled when starting broadcasting.
The invention has the advantages that: the code check according to audio frequency and video is provided with the size that audio frequency and video bitstream cushions, and this method can effectively be saved Installed System Memory, and can guarantee enough bufferings.As long as just start broadcasting when when just starting broadcasting, guaranteeing the video data of a hardwood with user's redirect, can effectively reduce user's stand-by period like this, and can be the fastest the first frame picture of film, or the new picture after the redirect represents to the user.