Summary of the invention
In order to overcome the above-mentioned defective of prior art, the invention provides a kind of adaptive multimedia stream link transmission method, can carry out transfer of data according to the adaptively selected unicast or multicast mode of network traffic conditions, when network traffics are big, can not influence the basic demand for services of user, and make things convenient for multicast users to add the multicast group; When network traffics hour, can make full use of the resource in the network.
The technical solution adopted in the present invention is:
A kind of adaptive multimedia stream link transmission method, the source node (comprising server node) that is used for improving described media stream link is to the transfer of data between destination node (comprising client node), server node is according to the network effective discharge of actual measurement and to select to adopt clean culture automatically to the client node of described server node request identical data or process number still be that the multicast mode is transmitted data to client node, if the network effective discharge is big or more to the client node and/or the process number of described server node request identical data, then adopt the multicast mode to transmit data, if the network effective discharge is less and less to the client node and/or the process number of described server node request identical data, then adopt mode of unicast transmission data.
Be preferably, the size of described network effective discharge is determined by the total bandwidth that the service chaining number of described server node and client node institute requested service bandwidth and network can provide, if the ratio of the total bandwidth that the less and described client node of the service chaining number of described server node institute's requested service bandwidth and network can provide is less, determine that then described network effective discharge is less.
More preferably, the definite of described network effective discharge can send realization by the periodicity of the control information before the transfer of data, the ratio of the total bandwidth that described client node institute's requested service bandwidth and network can provide can be reflected by the two-way time RTT of the data in the described control information from the server node to the client node, if RTT is bigger, the ratio of representing the total bandwidth that described client node institute's requested service bandwidth and network can provide is bigger, if RTT is less, represent that the ratio of the total bandwidth that described client node institute's requested service bandwidth and network can provide is less.
Definite method of described RTT size can be set a transfer of data standard time two-way time from the server node to the client node for: grid of reference effective discharge very hour data, the real time is transmitted in control information and the described data transmission standard time compares, if the control information transmission real time, determines then that described RTT is less less than the described data transmission standard time;
The service chaining of described server node count what definite method can for: the empirical value of setting a service chaining number as service chaining count standard value or grid of reference effective discharge when very little the service chaining number of server node set an empirical equation, again the result value of this empirical equation is counted standard value as service chaining, service chaining when control information is transmitted is counted actual value and described service chaining and is counted standard value and compare, if the service chaining during described control information transmission count actual value less than shown in service chaining count standard value, determine that then described service chaining number is less.
More preferably, described data transmission standard time tStd=t0/ 2+ α T, described service chaining is counted standard value NStd=N0+ β n, wherein, t0Be the described network effective discharge very two-way time of hour data from the server node to the client node, time fluctuation tolerance limit when T is network congestion, N0Be the service chaining number of described network effective discharge server node when very little, n is respectively two-way time and link number weights, 0≤α≤1,0≤β≤1 for link number fluctuation tolerance limit, α, β.
More preferably, described network has determining to comprise and judging the bandwidth that client node is asked and the magnitude relationship of server node remaining bandwidth of flow, the bandwidth that described client node is asked less than the server node remaining bandwidth as described network effective discharge is judged to be less necessary condition.
In above-mentioned each technical scheme, more preferably, can also set that a client node to described server node request identical data is counted standard value or process is counted standard value, when surveying actual value to the client node number of described server node request identical data or process number less than corresponding standard value, then be judged to be to the client node or the process number of described server node request identical data less, as judging that the data transfer mode that adopt is different from the data transfer mode of actual employing, is then adjusted data transfer mode by described server node.
More preferably, counting standard value or process to the client node of described server node request identical data, to count standard value be 2 or 3, and described mode of unicast transmits data based on Transmission Control Protocol, and described multicast mode is transmitted data based on udp protocol.
More preferably, when adopting UDP multicast mode to transmit data, set the size of UDP message bag in application layer according to the network performance of the systematic function of described server node and multimedia link, if above-mentioned better performances, then the UDP message bag is got greatly, otherwise, get forr a short time, and the maxsize value of message segment in the packet (the promptly clean data of carrying) is that the size of 1472 bytes or described UDP message bag is the minimum value that is less than or equal to the MTU value of each router in the network that obtains by described control information.
More preferably, when selecting UDP multicast mode to transmit data, retransmit and/or packet loss below application layer realizes: (1) retransmits: require to retransmit when the data packet loss causes not reaching basic service quality; Or when the one-way transmission time when playing the time of delay allowed, control realizes optionally retransmitting according to sequence number; (2) packet loss: adopt the combination of following any packet loss mechanism or two kinds of packet loss mechanism; (a) bag that will retransmit lost if the re-transmission time is longer than the time of delay that broadcast allows; (b) when network congestion, the packet loss control mode that the bag of employing interval several successive is lost a bag.
The invention has the beneficial effects as follows:
Adopt method of the present invention to select unicast or multicast mode to transmit data adaptively according to network traffic conditions, can also adjust data transfer mode at any time according to the variation of the quantity of network traffic conditions and request client computer of identical data or process, therefore be implemented in network traffics and adopt mode of unicast transmission data when little, both improved reliability of data transmission, guarantee the quality of service, avoided the waste of network traffics again; When network is busier, adopt the multicast mode to transmit data, both can guarantee basic data transmission quality, reduce the burden of server end simultaneously, not influence the basic demand for services of user, make things convenient for multicast users to add the multicast group again, avoid excessively taking of Internet resources being caused the network system collapse, help the stable of network system because of what clean culture caused.
Embodiment
In order to explain the present invention better,, but do not constitute limiting the scope of the invention so that better understanding is described in greater detail the present invention by embodiment below in conjunction with accompanying drawing.
Referring to Fig. 1 to Fig. 5, the invention provides a kind of adaptive multimedia stream link transmission method, the source node that is used for improving described media stream link (as shown in Figure 1) to message transmission rate between destination node and quality etc. (with server node as source node, client node describes as the embodiment of destination node), server node is according to the network effective discharge of actual measurement and to select to adopt clean culture automatically to the client node of described server node request identical data or process number still be that the multicast mode is transmitted data to client node, if the network effective discharge is big or more to the client node and/or the process number of described server node request identical data, then adopt the multicast mode to transmit data, add the multicast group in the time of both can having made things convenient for the different process requested identical data of other client node or same client node, do not influence current transfer of data again, do not increase the flow load of server node, guarantee user's basic service demand; If the network effective discharge is less and less to the client node and/or the process number of described server node request identical data, then adopt mode of unicast transmission data, can make full use of the resource in the network, improve the efficiency of transmission of media stream.
Service chaining number and client node institute requested service bandwidth and the network total bandwidth that can the provide size of determining described network effective discharge of the present invention by determining described server node.If the ratio of the total bandwidth that the less and described client node of the service chaining number of described server node institute's requested service bandwidth and network can provide is less, it is less then to be defined as described network effective discharge, in addition, think that then described network effective discharge is bigger.
Particularly, can before beginning to transmit data, determine described network effective discharge by sending of control message information, wherein, the ratio of the total bandwidth that described client node institute's requested service bandwidth and network can provide can be reflected by the two-way time RTT of the data in the described control message information from the server node to the client node, if RTT is bigger, the ratio of representing the total bandwidth that described client node institute's requested service bandwidth and network can provide is bigger, if RTT is less, represent that the ratio of the total bandwidth that described client node institute's requested service bandwidth and network can provide is less.
Definite method of described RTT size can be set a transfer of data standard time two-way time from the server node to the client node for: grid of reference effective discharge very hour data, the real time is transmitted in control information and the described data transmission standard time compares, if the control information transmission real time, determines then that described RTT is less less than the described data transmission standard time; Otherwise, determine that then described RTT is bigger.So-called network effective discharge is very little, can be the network effective discharge under the artificial a kind of splendid network state of selecting, and can determine according to experience.
The service chaining of described server node count what definite method can for: the empirical value of setting a service chaining number as service chaining count standard value or grid of reference effective discharge when very little the service chaining number of server node set an empirical equation, again the result value of this empirical equation is counted standard value as service chaining, service chaining when control information is transmitted is counted actual value and described service chaining and is counted standard value and compare, if the service chaining when described control information is transmitted is counted actual value and counted standard value less than described service chaining, determine that then described service chaining number is less; Otherwise, determine that then described service chaining number is bigger.
Usually, described server node is by periodically sending the control message information and obtain real-time RTT information and the service chaining of server node being counted information, and in real time and corresponding standard value compare size with the described network effective discharge of real-time judge, the service chaining number of described server node is the sum to the All Clients node of its request service, comprises the total quantity and total quantity to the client node of the different services of its request of asking the client node of same service to it.
Wherein, the transmission cycle of described control message information should determine according to actual conditions, can not be oversize can not be too short.If oversize then can not in time obtain network effective discharge situation, cause the decline of algorithm performance; If too short, though can well immediately obtain reaction, know network effective discharge situation, will cause increasing in a large number of control information (comprising control message information and ACK response message) simultaneously, be a kind of extra burden to network.
Be preferably, set described data transmission standard time tStd=t0/ 2+ α T, described service chaining is counted standard value NStd=N0+ β n, wherein, t0Be the described network effective discharge very two-way time of hour data from the server node to the client node, time fluctuation tolerance limit when T is network congestion, N0Be the service chaining number of described network effective discharge server node when very little, n is link number fluctuation tolerance limit, and when the node processing ability was strong in the network, the value of n can be greatly corresponding.α, β are respectively two-way time and link number weights, 0≤α≤1,0≤β≤1.Weights α can determine that to the jumping figure of described client node the big more α value that should choose of jumping figure is just big more according to described server node, and weights β can determine that the strong more β value that should choose of disposal ability is just big more according to the disposal ability of described server node.
Referring to Fig. 2 and Fig. 3, Fig. 2 shows and works as t0=200ms, α=0.9 o'clock, the data transmission standard time when T gets different value; Fig. 3 shows and works as N0=70 o'clock, the maximum link number (described service chaining is counted standard value) that network effective discharge hour n is allowed when getting different value, wherein, β1~β5Represent that respectively β gets different values.
In the practice, the bandwidth B that the determining preferably also of described network effective discharge will be asked in conjunction with more described client nodeiWith the magnitude relationship of described server node remaining bandwidth B, be preferably bandwidth that described client node is asked less than the server node remaining bandwidth as described network effective discharge is judged to be less necessary condition.Promptly work as tCi<t0/ 2+ α T, Ni<N0+ β n and BiWhen<B set up simultaneously, it was less just to be judged to be the network effective discharge, and it is bigger that other situations all can be judged to be the network effective discharge, and wherein, i represents i client node, tCiThe RTT actual value of representing control information when transmission of i client node, NiRepresent that the service chaining in control information when transmission of i client node counts actual value, BiRepresent the bandwidth that i client node asked, B represents the server node remaining bandwidth.
When continuing the transmission of client node request msg is arranged, the speed and the quality of legacy data transmission on the multimedia link will be had influence on more or less, therefore more preferably, can also be in above-mentioned each technical scheme according to the actual treatment ability of server node and to how many dynamic adjusting data transmission meanss of the client node number or the process number of this same server node request identical data, to adapt to changeable Network Transmission environment.Because the detection of network traffics and judgement are periodically to carry out, therefore from whole network transmission process, the client node number of request identical data or the judgement how many processes counts and the judgement of network traffics size interweave, hocket.
Only count what judgement below, carry out the example that is judged as of network traffics size again, be intended to specify the two deterministic process that combines and principle to carry out client node number or process earlier.As shown in Figure 4, can set that a client node to described server node request identical data is counted standard value or process is counted standard value, when surveying actual value to the client node number of described server node request identical data or process number less than corresponding standard value, then be judged to be to the client node or the process number of described server node request identical data less, if the network effective discharge is less simultaneously, then adopt mode of unicast transmission data, otherwise adopt the multicast mode to transmit data, as judging that the data transfer mode that adopt is different from the data transfer mode difference of actual employing, is then adjusted data transfer mode by described server node.
For example, current data transfer mode is clean culture, at this moment, if continue to have the client node request data transfer, less than corresponding standard value, proceed the judgement of network traffics size through judging actual value to the client node number of described server node request identical data, if the network effective discharge is less, then continue to adopt mode of unicast,, then should be adjusted into the multicast mode if the network effective discharge is bigger; If through judging that actual value to the client node number of described server node request identical data more than or equal to corresponding standard value, then should directly be adjusted into the multicast mode.
In fact, also can set when being less than or equal to corresponding standard value, adopt mode of unicast, and during greater than corresponding standard value, adopt the multicast mode.
Be embodied in the program control, can adopt following statement to carry out above-mentioned two kinds of judgements and definite employing clean culture still is the data transfer mode of multicast:
if?((t2-t1<t0/2+αT)&&(Ni<N0+βn)&&(Bi<B))
{
If (the client node number and/or the process number of request identical data 〉=standard value of client node number and/or process number)
{
Multicast;
}
else
{
Clean culture
};
}
else
{ multicast;
}
As shown in Figure 5, t in the said procedure section1For server node sends the time point of controlling message information, t2For client node is received the time point of this control message information, t2-t1Being the control message information sends from server node, receive the time delay that this control message information is experienced to described client node, perhaps begin to receive half of the time delay that experiences altogether from the affirmation of client node to the server node end for the control message information sends from server node.
The client node number of request identical data or judgement institute accepted standard value that how many processes counts can determine according to experience, and preferably, counting standard value or process to the client node of described server node request identical data, to count standard value be 2 or 3.
Described multicast mode is preferably based on udp protocol transmission data.Described mode of unicast is preferably based on Transmission Control Protocol transmission data, to guarantee reliability of data transmission, simultaneously, also helps making full use of the resource (mainly being bandwidth resources) in the network.Because the effective discharge in the network is less at this moment, the windowing mechanism of TCP can increase the send window of self, make the size of TCP message become big, message length increases, because same TCP message has only an IP head, like this, the header that produces when the subpackage of IP layer is just few, control information simultaneously is also less, and the ACK response message of generation is also less, can improve media stream link transmission efficient in time to a certain extent like this.
Through aforesaid two kinds of judgements, if the current server node adopts the TCP mode of unicast when client node sends data, if when becoming enough big by the data traffic (effective discharge) in the network that obtains of control message information (RTT enough greatly and/or the service chaining number of server node abundant), data transfer mode will become the UDP multicast; If current data transfer mode is the UDP multicast, and the client node of asking same service is less than or equal to 2(or 3) when individual, (not free time-delay or RTT were enough little in enough hour if the data traffic of obtaining network by the control message information becomes, and the bandwidth service device node that client node is asked can provide), data transfer mode becomes the TCP clean culture, if the client node of the same service of request is more than 2(or 3) when individual, then still keep the UDP multicast need not adjust.Whole process circulates repeatedly, to guarantee the transmission speed and the quality of media stream.In time clean culture is adjusted into multicast, can guarantees the speed transmitted, avoid can also avoiding the defective of following two aspects under the mode of unicast too much the taking of network bandwidth resources:
(1) server node is because of remaining listening state to understand the service request of each client node that dynamically adds, and create socket and be the cpu resource of intercepting consumption systems of socket, the real-time that too frequent intercepting may cause the unstable of system and destroy transmission of multimedia streams.
(2) server node is in the face of the same service request of different client node, need repeat to transmit, several client node just need take several times network bandwidth resources, network bandwidth resources has been caused greatly waste, and cause packet loss, delay etc. easily, when the quantity of client node reaches some when (as more than five), also cause broadcast storm easily, cause the collapse of network system.
In time multicast is adjusted into clean culture, can realizes the high-speed transfer that reliability is higher, the bandwidth resources of whole network are fully used, avoid waste.
Because the UDP transmission means is towards message, the message that the transport layer of transmit leg (server node) produces application layer just consigns to the IP layer downwards after adding stem, if the length of the UDP message of paying surpasses the MTU value (MTU) of IP layer, just need split at the IP layer, if the UDP message of paying does not surpass the MTU value of IP layer, just do not deal with, and keep the border of these messages, therefore, the application program that sends data need be selected suitable message size.
More preferably, when adopting UDP multicast mode to transmit data, can set the network performance of size, the especially multimedia link of UDP message bag in application layer according to the network performance of the systematic function of described server node and multimedia link, as, if network state good (it is little to be often referred to the network effective discharge), then the UDP message bag is got greatly, with raising systematic function (especially speed), otherwise, get littler, to reduce packet loss.
Under the environment of local area network (LAN), because the MTU value of ethernet link layer is generally 1500 bytes, the MSS value that deducts after the header data (IP packet header 20 bytes and UDP packet header 8 bytes) generally is defaulted as 1472 bytes, therefore, the size of message segment is preferably and is not more than 1472 bytes in the packet, avoiding burst reorganization, when especially transmitting data in UDP multicast mode.Under the environment of Wide Area Network, each router in the network may have and be configured to different value (as less than default value), if the UDP message bag is during greater than the MTU value set, the UDP message bag just need carry out burst at the IP layer, can produce the fragment of a lot of packets this moment, when the network effective discharge is big, in case during the packet generation packet loss after the burst, UDP message bag before the burst will be lost by whole, can cause bigger influence to the reliability of data transmission of media stream thus.When the practical application of UDP transmission, hour transmission rate is also higher for the size of packet, usually can obtain preferable performance, but packet is more little, the expense of datagram header is also just big more, when packet is too small, can bring negative effect to transmission performance on the contrary, therefore, need choose the size of suitable packet, control the information that can also comprise the MTU value of obtaining each router in the network in the message information as described, to obtain the MTU value of each router in the network by the control message information, choose wherein minimum value and determine the size of UDP message bag, the size of guaranteeing packet is not more than the minimum MTU value in described each router, also needs to carry out burst when avoiding the UDP message bag by each router, and then avoids the series of negative influence that causes owing to burst.
More preferably, when a network effective discharge hour described packet should be tried one's best greatly, described packet should not surpass the size of network effective discharge hour when described network effective discharge is big.
Because UDP is that a kind of nothing connects insecure transport layer protocol, there are not congested control, flow control and retransmission mechanism, therefore, in order to guarantee reliability of data transmission, in above-mentioned any technical scheme, when elected majority broadcast mode transmits data, can guarantee reliability of data transmission by application layer, for example can adopt mechanism such as comprising timing, re-transmission, packet loss and/or sequence number, concrete mode comprises: (1) retransmits: require to retransmit when the data packet loss causes not reaching the basic or artificial service quality that requires; Or when the one-way transmission time when playing the time of delay allowed, adopt to retransmit, and optionally retransmit according to sequence number as controlling mechanism; (2) packet loss: adopt the combination of following one or both packet loss mechanism, if (a) the re-transmission time is longer than the delay that broadcast allows then the bag that will retransmit lost; (b) when network congestion, the packet loss control mode of losing y bag by interval x continuous bag guarantees service quality.
More preferably, in the described mode (b), described x, y value are for default adjustable, and the x value is fixing or unfixing in certain time length, and the x value is greater than the y value usually, and the y value gets 1 usually; Also for default adjustable, the size of wrapping in certain time length is identical or different to the size of bag, and the size of wrapping in certain time length is for fixing or unfixed.For example can lose a bag every four bags.
Sequence number can guarantee that the packet that receives can arrange in order, can require to retransmit when the data packet loss does not reach basic service quality.General Streaming Media has strict restriction to reproduction time, does not adopt retransmission mechanism to carry out loss recovery usually, if still the one-way transmission time then can adopt re-transmission as controlling mechanism far below playing the delay that is allowed.For guaranteeing service quality to greatest extent and transmission speed, can optionally retransmit according to sequence number, neither destroy the flatness of data flow, the transmission that can guarantee packet does not again produce excessive delay variation, if being longer than the delay that broadcast allows, the bag that retransmits can also be lost the re-transmission time, to guarantee maximum using Internet resources on the basis that does not influence data transmission quality.
In the Streaming Media transmission (as multimedia video stream), usually not high to the reliability requirement of transfer of data, with respect to reliability, actual performance (especially fluency, flatness etc.) is paid attention in the application of UDP more, so often can sacrifice certain reliability (as image quality) in order to obtain better result of use (as higher picture refreshing speed), the effect that influences the video broadcast that therefore suitable loss of data can be not too much.In addition, packet loss is a normal phenomenon under the situation of network congestion because UDP is transmitted in, therefore, the network effective discharge big (during network congestion) can guarantee service (transmission speed) by the packet that the mode of control packet loss is lost some.If packet loss will cause video unclear continuously, can't guarantee basic service, therefore when the control packet loss, should be implemented in the continuous several packets in interval and lose a packet, this packet loss mode can effectively be avoided in the media stream multicast, network congestion on certain link influences whole multicast conversation, can also avoid the generation of passive continuous packet loss phenomenon, and can not influence basic video transmission quality, reduce the burden of server node simultaneously, guarantee certain service quality.
In whole network system, clean culture and multicast are simultaneous often, when the network effective discharge under the long-time situation about existing of bigger and multicast, as other client node (as the different processes of other destination hosts or same main frame) when the same services request is arranged, transmit data if select in UDP multicast mode, this client node can add corresponding multicast group by the IGMP message and can not influence the transfer of data of current multicast group, and its datagram header expense is less for TCP, transmission speed is also faster, also avoided increasing sharply of flow in the network, and UDP message wraps in the speed of transmitting in the link and can not keep out of the way, can force existing TCP to connect according to windowing mechanism simultaneously keeps out of the way the data rate of itself, be that the UDP message bag preferentially takies idle network bandwidth resources, and TCP only takies remaining network bandwidth resources, and therefore, its message transmission rate can be not restricted when selecting UDP multicast mode for use, can transmit with the speed of maximum, guarantee service quality.
Method of the present invention can be transmitted data according to the adaptively selected TCP clean culture of network traffic conditions/UDP multicast mode, can either be in the high reliability of network traffics hour assurance transfer of data, avoid the waste of bandwidth resources, can also when network traffics are big, guarantee the two-forty of transfer of data, guarantee service quality.