Summary of the invention
In order to solve the problem of prior art, the embodiment of the present invention provides a kind of method and device of transmitting multimedia data.Described technical scheme is as follows:
On the one hand, provide a kind of method of transmitting multimedia data, described method comprises:
The detection data that receiving multimedia data receiving terminal sends, at least comprise packet loss in described detection data;
When described detection data are greater than predetermined threshold value, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon;
Frame data except described the first non-reference frame in described multi-medium data waiting for transmission are sent to described multi-medium data receiving terminal.
Preferably, described first non-reference frame that need to abandon of choosing in multi-medium data waiting for transmission, comprising:
According to the second non-reference frame in the multi-medium data of previous transmission cycle transmission, determine the quantity of first non-reference frame that need to abandon;
The quantity of the first non-reference frame abandoning according to described needs is chosen described first non-reference frame that need to abandon in multi-medium data waiting for transmission.
Preferably, described according to the second non-reference frame in the multi-medium data of previous transmission cycle transmission, determine the quantity of first non-reference frame that need to abandon, comprising:
Obtain the quantity of the second non-reference frame and the capacity of described the second non-reference frame in the multi-medium data of previous transmission cycle transmission, and calculate the mean value of the capacity of described the second non-reference frame;
According to the encoder bit rate of the generation multi-medium data of current setting, the capacity mean value of described detection data and described the second non-reference frame, the quantity of the first non-reference frame that calculating need to abandon.
Preferably, the quantity of described the first non-reference frame abandoning according to described needs is chosen described first non-reference frame that need to abandon in multi-medium data waiting for transmission, comprising:
The quantity of the first non-reference frame abandoning according to non-reference frame default stored number and described needs in each transmission cycle, calculate the interval that abandons of non-reference frame, and according to non-reference frame default arrangement position in each transmission cycle, every described non-reference frame, abandon the position that the first non-reference frame that described needs abandon is chosen at interval, described the first non-reference frame abandoning as the needs of choosing in multi-medium data waiting for transmission.
Preferably, described by after in described multi-medium data waiting for transmission, the frame data except described the first non-reference frame send to described multi-medium data receiving terminal, described method also comprises:
When the detection data that receive are less than predetermined threshold value, stop carrying out the operation that abandons described the first non-reference frame, multi-medium data waiting for transmission is directly sent to described multi-medium data receiving terminal.
On the other hand, provide a kind of device of transmitting multimedia data, described device comprises:
Receiver module, the detection data that send for receiving multimedia data receiving terminal, at least comprise packet loss in described detection data;
Choose module, for when described detection data are greater than predetermined threshold value, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon;
The first transport module, for by described multi-medium data waiting for transmission, the frame data except described the first non-reference frame send to described multi-medium data receiving terminal.
Preferably, described in choose module, comprising:
Determining unit, for according to the second non-reference frame of the multi-medium data of previous transmission cycle transmission, determines the quantity of first non-reference frame that need to abandon;
Choose unit, for the quantity of the first non-reference frame of abandoning according to described needs, in multi-medium data waiting for transmission, choose described first non-reference frame that need to abandon.
Preferably, described determining unit, comprising:
The first computation subunit, for obtaining the quantity of multi-medium data the second non-reference frame and the capacity of described the second non-reference frame of previous transmission cycle transmission, and calculates the mean value of the capacity of described the second non-reference frame;
The second computation subunit, for according to the encoder bit rate of the generation multi-medium data of current setting, the capacity mean value of described detection data and described the second non-reference frame, the quantity of the first non-reference frame that calculating need to abandon.
Preferably, described in, choose unit specifically for:
The quantity of the first non-reference frame abandoning according to non-reference frame default stored number and described needs in each transmission cycle, calculate the interval that abandons of non-reference frame, and according to non-reference frame default arrangement position in each transmission cycle, every described non-reference frame, abandon the position that the first non-reference frame that described needs abandon is chosen at interval, described the first non-reference frame abandoning as the needs of choosing in multi-medium data waiting for transmission.
Preferably, described device also comprises:
The second transport module, while being less than predetermined threshold value for the detection data when receiving, stops carrying out the operation that abandons described the first non-reference frame, and multi-medium data waiting for transmission is directly sent to described multi-medium data receiving terminal.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is:
While being greater than predetermined threshold value by the Monitoring Data when multi-medium data receiving terminal feedback, initiatively abandon the non-reference frame in multi-medium data waiting for transmission, do not affect receiving terminal and receive the decoding to other frame data after multi-medium data; Initiatively abandoned after part non-reference frame data on the other hand, reduced the capacity of multi-medium data in each transmission cycle, improved the efficiency of transmission of receiving terminal.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment mono-
The embodiment of the present invention provides a kind of method of transmitting multimedia data, and referring to Fig. 1, method flow comprises:
101: the detection data that receiving multimedia data receiving terminal sends, detect in data and at least comprise packet loss;
102: when detection data are greater than predetermined threshold value, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon;
103: the frame data except the first non-reference frame in multi-medium data waiting for transmission are sent to multi-medium data receiving terminal.
When the embodiment of the present invention is greater than predetermined threshold value by the Monitoring Data when multi-medium data receiving terminal feedback, initiatively abandon the non-reference frame in multi-medium data waiting for transmission, do not affect receiving terminal and receive the decoding to other frame data after multi-medium data; Initiatively abandoned after part non-reference frame data on the other hand, reduced the capacity of multi-medium data in each transmission cycle, improved the efficiency of transmission of receiving terminal.
Embodiment bis-
The embodiment of the present invention provides a kind of method of transmitting multimedia data, and referring to Fig. 2, method flow comprises:
201: multi-medium data receiving terminal detects current network conditions in real time, and generation detection data send to multi-medium data transmitting terminal.
Wherein, network condition is detected, calculate the ability to accept of receiving terminal, can carry out the detection of many kinds of parameters, the packet loss of for example take in embodiments of the present invention describes as example.
Wherein, in certain transmission cycle, for example transmission cycle is 1 second, detects number loss_num and the packet receiving number rec_num of packet loss, and establishing packet loss is loss_rate, so the computing formula of this packet loss can be following mode:
Further, can also be by data such as Sampling network delays as detecting data, at this, do not make restriction, can also detect multiple network condition parameter, for example comprise packet loss, network delays etc., send to transmitting terminal using the parameter of these multiple types together as detecting data, make transmitting terminal according to the parameter of multiple types, abandon the judgement of the operation of non-reference frame data.
202: the detection data that transmitting terminal receiving multimedia data receiving terminal sends, detect in data and at least comprise packet loss.
Set in advance threshold value skip_threold, can the particular content of this threshold value be set according to actual conditions, for example, skip_threold=5 is set.
The detection data that the multi-medium data receiving terminal at every turn receiving is sent, packet loss and this predetermined threshold value contrast, if detect when data are greater than predetermined threshold value, perform step 203, choose the step of the non-reference frame that need to abandon; If Monitoring Data is less than or equal to threshold value, do not perform step 203, continue according to original send mode, send multi-medium data in a complete transmission cycle to multi-medium data receiving terminal.
Further, while there are the data of multiple types in detecting data, can according to the type that detects data, corresponding predetermined threshold value be set respectively.
203: when detection data are greater than predetermined threshold value, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon.
Before the operation that abandons non-reference frame, need to determine and in the multi-medium data waiting for transmission of each transmission cycle, need the first non-reference frame of abandoning, comprising the first non-reference frame, in each transmission cycle, need the quantity and the residing position that abandon.Because the multi-medium data transmitting in each transmission cycle is to consist of reference frame and non-reference frame, wherein in reference frame, be divided into again I frame and P frame, wherein non-reference frame is B frame.Wherein, in reference frame, carry the data for assisting non-reference frame to decode, the decoding data for assisting non-reference frame to decode providing in reference frame need to be provided non-reference frame, if therefore non-reference frame is lost in multi-medium data, does not hinder the decoding of other frame data.
The quantity of the first non-reference frame that definite needs abandon and the process of position are as follows respectively.Therefore the process of, choosing the first non-reference frame in step 203 can be specially:
2031: according to the second non-reference frame in the multi-medium data of previous transmission cycle transmission, determine the quantity of first non-reference frame that need to abandon.
Before the operation that abandons non-reference frame, need to determine and in the multi-medium data waiting for transmission of each transmission cycle, need the first non-reference frame of abandoning, comprising the first non-reference frame, in each transmission cycle, need the quantity and the residing position that abandon.Because the multi-medium data transmitting in each transmission cycle is to consist of reference frame and non-reference frame, wherein in reference frame, be divided into again I frame and P frame, wherein non-reference frame is B frame.Wherein, in reference frame, carry the data for assisting non-reference frame to decode, the decoding data for assisting non-reference frame to decode providing in reference frame need to be provided non-reference frame, therefore, if non-reference frame is lost in the transmitting procedure of multi-medium data, decoding that also can other frame data counteracts.
Wherein, the mode for the quantity of the first non-reference frame abandoning in the multi-medium data needing after determining from then in each transmission cycle of transmission can be specially:
20311: obtain the quantity of the second non-reference frame and the capacity of the second non-reference frame in the multi-medium data of previous transmission cycle transmission, and calculate the mean value of the capacity of the second non-reference frame.
The process of the quantity of the first non-reference frame abandoning in the multi-medium data in each transmission cycle that needs to transmit after calculating from then on, need quantity and capacity with reference to non-reference frame in the multi-medium data transmitting in previous transmission cycle, i.e. the second non-reference frame.The quantity of the second non-reference frame wherein, obtaining in this step and the capacity of the second non-reference frame are obtained by transmitting terminal record when the previous transmission cycle sends multi-medium data.Further, the mean value of establishing the capacity of the second non-reference frame is B_framesize.
20312: according to the encoder bit rate of the generation multi-medium data of current setting, detect the capacity mean value of data and the second non-reference frame, the quantity of the first non-reference frame that calculating need to abandon.
Wherein, encoder bit rate M is the default parameter of transmitting terminal.The formula that calculates the quantity skip_Bframe_num of first non-reference frame that need to abandon according to the packet loss loss_rate in the mean value B_framesize of the capacity of encoder bit rate M, the second non-reference frame and detection data is:
2032: the quantity of the first non-reference frame abandoning as required, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon.
After having determined the quantity of first non-reference frame that need to abandon, need to be according to non-reference frame default arrangement position in each transmission cycle, determine the position that needs the first non-reference frame of abandoning in multi-medium data waiting for transmission.
In embodiments of the present invention, need level and smooth first non-reference frame that need to abandon of choosing, so that receiving terminal is receiving the multi-medium data that has abandoned the first reference frame, and while using this multi-medium data after decoding multimedia data, as much as possible little on user's impact.Therefore, the level and smooth process need of choosing first non-reference frame that need to abandon is according to non-reference frame default arrangement position in each transmission cycle, and the quantity that abandons the first non-reference frame obtains, and concrete computational process is as follows:
Because non-reference frame is predefined arrangement position and stored number in each transmission cycle, the quantity skip_Bframe_num of the first non-reference frame therefore abandoning as required, chooses the position of first non-reference frame that need to abandon in the arrangement position at non-reference frame in each transmission cycle.First, establish non-reference frame is that predefined stored number is B_fps in each transmission cycle, and that calculates non-reference frame abandons interval B_skip_interval, and this formula is:
According to the interval B_skip_interval that abandons of the non-reference frame calculating, at non-reference frame, in each transmission cycle, in default arrangement position, choose the position of first non-reference frame that need to abandon.
Therefore, the process of step 2032 can be specially:
The quantity of the first non-reference frame abandoning according to non-reference frame default stored number and described needs in each transmission cycle, calculate the interval that abandons of non-reference frame, and according to non-reference frame default arrangement position in each transmission cycle, every described non-reference frame, abandon the position that the first non-reference frame that described needs abandon is chosen at interval, described the first non-reference frame abandoning as the needs of choosing in multi-medium data waiting for transmission.
204: the frame data except the first non-reference frame in multi-medium data waiting for transmission are sent to multi-medium data receiving terminal.
Illustrate:
As shown in Figure 3, in figure, be the multi-medium data that needs complete in a transmission cycle transmit, wherein 1 is reference frame, 0 is non-reference frame.If the quantity skip_Bframe_num of first non-reference frame that need to abandon is 2, if non-reference frame is predefined quantity in each transmission cycle, be that B_fps is 4, therefore abandoning after interval B_skip_interval calculates of non-reference frame obtains 2, therefore according to abandoning one every two non-reference frames.
As shown in Figure 4, in figure, be in a transmission cycle, to abandon the schematic diagram of the multi-medium data after the first non-reference frame; As shown in Figure 5, for preparing to be transferred to the multi-medium data of multi-medium data receiving terminal.
The multi-medium data transmitting from now start each transmission cycle is the flow process that need to abandon the first non-reference frame, position and quantity according to the first non-reference frame of determining in step 203 are carried out discard processing, until the detection data that receive are while being less than predetermined threshold value, execution step 205.
205: when the detection data that receive are less than predetermined threshold value, stop carrying out the operation that abandons the first non-reference frame, multi-medium data waiting for transmission is directly sent to multi-medium data receiving terminal.
Multi-medium data receiving terminal periodically sends and detects data to transmitting terminal, until the detection data that receive are less than predetermined threshold value, finish to abandon the flow process of the first non-reference frame, send that now last has abandoned after the multi-medium data of the first non-reference frame, the multi-medium data again transmitting is all complete.
When the embodiment of the present invention is greater than predetermined threshold value by the Monitoring Data when multi-medium data receiving terminal feedback, initiatively abandon the non-reference frame in multi-medium data waiting for transmission, do not affect receiving terminal and receive the decoding to other frame data after multi-medium data; Initiatively abandoned after part non-reference frame data on the other hand, reduced the capacity of multi-medium data in each transmission cycle, improved the efficiency of transmission of receiving terminal.
Embodiment tri-
The embodiment of the present invention provides a kind of device of transmitting multimedia data, and referring to Fig. 6, this device comprises:
Receiver module 601, the detection data that send for receiving multimedia data receiving terminal, detect in data and at least comprise packet loss;
Choose module 602, for when detection data are greater than predetermined threshold value, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon;
The first transport module 603, for by multi-medium data waiting for transmission, the frame data except the first non-reference frame send to multi-medium data receiving terminal.
Wherein, choose module 602, comprising:
Determining unit, for according to the second non-reference frame of the multi-medium data of previous transmission cycle transmission, determines the quantity of first non-reference frame that need to abandon;
Choose unit, for the quantity of the first non-reference frame of abandoning as required, in multi-medium data waiting for transmission, choose first non-reference frame that need to abandon.
Wherein, determining unit, comprising:
The first computation subunit, for obtaining the quantity of multi-medium data the second non-reference frame and the capacity of the second non-reference frame of previous transmission cycle transmission, and calculates the mean value of the capacity of the second non-reference frame;
The second computation subunit, for according to the encoder bit rate of the generation multi-medium data of current setting, detects the capacity mean value of data and the second non-reference frame, the quantity of the first non-reference frame that calculating need to abandon.
Wherein, choose unit specifically for:
The quantity of the first non-reference frame abandoning according to non-reference frame default stored number and described needs in each transmission cycle, calculate the interval that abandons of non-reference frame, and according to non-reference frame default arrangement position in each transmission cycle, every described non-reference frame, abandon the position that the first non-reference frame that described needs abandon is chosen at interval, described the first non-reference frame abandoning as the needs of choosing in multi-medium data waiting for transmission.
Wherein, device also comprises:
The second transport module 604, while being less than predetermined threshold value for the detection data when receiving, stops carrying out the operation that abandons the first non-reference frame, and multi-medium data waiting for transmission is directly sent to multi-medium data receiving terminal.
When the embodiment of the present invention is greater than predetermined threshold value by the Monitoring Data when multi-medium data receiving terminal feedback, initiatively abandon the non-reference frame in multi-medium data waiting for transmission, do not affect receiving terminal and receive the decoding to other frame data after multi-medium data; Initiatively abandoned after part non-reference frame data on the other hand, reduced the capacity of multi-medium data in each transmission cycle, improved the efficiency of transmission of receiving terminal.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step that realizes above-described embodiment can complete by hardware, also can come the hardware that instruction is relevant to complete by program, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be read-only memory, disk or CD etc.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.