A kind of method that realizes streaming media playing clean culture, multicast seamless switchingTechnical field
The present invention relates to a kind of player method of media video, the method for particularly a kind of streaming media playing clean culture, multicast seamless switching.
Background technology
In the multicasting technology,, can reduce and have a plurality of recipients and listen to or check network traffic under the same asset situation simultaneously by transmitting single message stream mode to a plurality of recipients.And concurrent multicast group quantity of switch support while is limited, in order to save network traffic as far as possible, needs the multicast group of reasonable use switch.
The same stream medium data of new client-requested is arranged, and when the summation of asking the new number clients of same stream medium data and old number clients surpassed threshold values (setting according to system situation), then the streaming media server mode that sends stream medium data switched to multicast by clean culture; Have the part client no longer to ask same stream medium data or circuit to disconnect, and remaining number clients is when being lower than threshold values, then the streaming media server mode that sends stream medium data switches to clean culture by multicast.
The patent of publication number CN 101616060A has proposed a kind of this method of IPTV terminal multicast commentaries on classics clean culture changing method and comprised: the IPTV terminal of receiving group RTP packet is set up unicast channel after receiving that multicast changes the clean culture instruction; After unicast channel is built up, withdraw from multicast channel, and the request unicast data; Receive the time stamp and the numbering of RTP packet at last according to the multicast channel of record, and the up-to-date time stamp and the numbering of receiving the RTP packet of record, the RTP packet of receiving is filtered.This method might cause packet loss in multicast, clean culture when switching.
The patent of publication number CN 101547108 proposes by adopt F.F. when receiving unicast service, guarantee after switching to multicast service, to pull up to live progress, thereby solved the problem that program lags behind, cause the phenomenon of frame-skipping easily in video playback, and the transmission of very most of data all can not send (as real-time video etc.) in the mode of F.F., and also there is very big restriction in this mode.
Summary of the invention
The present invention proposes a kind of method that realizes streaming media playing clean culture, multicast seamless switching, in order to solve the problem of existing streaming media playing clean culture, the video frequency program interruption that exists when multicast is switched, hysteresis, frame-skipping.
A kind of method that realizes streaming media playing clean culture, multicast seamless switching that the present invention proposes comprises that streaming media playing clean culture seamless switching becomes the method for multicast to become the method for clean culture with streaming media playing multicast seamless switching, and general plotting is as follows:
In the process of switching, streaming media server sends stream medium data in the mode of clean culture, multicast to the client that broadcast mode need switch simultaneously;
After the client that described broadcast mode need switch is received the flow media data packet of repetition, send success message to streaming media server;
If the success message that streaming media server receives in the duration of regulation, then streaming media server switches the mode that sends stream medium data to the client of the same stream medium data of request;
Described success message switches to multicast if the switching of broadcast mode is clean culture, then is meant the adding success message, if the switching of broadcast mode is that multicast switches to clean culture, then is meant and withdraws from success message;
A kind of streaming media playing clean culture seamless switching of realizing becomes the method for multicast, may further comprise the steps:
1), streaming media server asks the client of same stream medium data to send adding multicast group command to all; And
Described streaming media server sends stream medium data in the mode of clean culture and multicast to old client simultaneously, and sends stream medium data in the mode of multicast to new client;
Wherein, described old client was meant before receiving described adding multicast group command by the client of mode of unicast from described streaming media server receiving stream media data; Described new client is meant the client except old client in the client of the same stream medium data of the described streaming media server request of forward direction.
2), described old client is according to described adding multicast group command, add the multicast group, and check whether the stream medium data that receives by multicast and mode of unicast has repetition: if having, then abandon the stream medium data of repetition, and send the adding success message to described streaming media server; With
Described new client adds the multicast group according to described adding multicast group command, receives the stream medium data that described streaming media server sends in the multicast mode, and sends the adding success message to described streaming media server;
3), if described streaming media server receives the described adding success message that described client sends in the regulation duration, then described streaming media server stops to send stream medium data in the mode of clean culture to clients corresponding, and only the mode with multicast sends stream medium data to described clients corresponding.
Wherein, described step 3 also comprises: if described streaming media server does not receive the described adding success message that described client sends in the regulation duration, then described streaming media server sends a query statement to clients corresponding, check described clients corresponding state, if do not receive receiveing the response of described clients corresponding, then described clients corresponding is deleted from the multicast group, no longer send stream medium data to described clients corresponding.
Wherein, make described client receive the stream medium data that described streaming media server sends in the mode of mode of unicast and multicast respectively by the multiplexed port technology by identical port.
A kind of streaming media playing multicast seamless switching of realizing becomes the method for clean culture, may further comprise the steps:
1), streaming media server withdraws from the multicast group command to the client transmission of the same stream medium data of current request; And
Described streaming media server sends stream medium data in the mode of clean culture and multicast to described client simultaneously;
2), described client is according to the described multicast group command that withdraws from, withdraw from the multicast group, and check whether the stream medium data that receives by clean culture and multicast mode has repetition: if having, then abandon the flow media data packet of repetition, withdraw from the multicast group, and withdraw from success message to described streaming media server transmission;
3), if described streaming media server receives the described success message that withdraws from that described client sends in the regulation duration, then described streaming media server stops to send stream medium data in the mode of multicast to clients corresponding, and only the mode with clean culture sends stream medium data to described clients corresponding.
Wherein, described step 3 also comprises: if described streaming media server does not receive the described success message that withdraws from that described client sends in the duration of regulation, then described streaming media server sends a query statement to clients corresponding, check the state of described clients corresponding, if do not receive receiveing the response of described clients corresponding, then described clients corresponding is deleted from the multicast group, no longer send stream medium data to described clients corresponding.
Wherein, make described client receive the stream medium data that described streaming media server sends in the mode of mode of unicast and multicast respectively by the multiplexed port technology by identical port.
A kind of method that realizes streaming media playing clean culture, clean culture seamless switching that the present invention proposes, in the process of switching, mode with clean culture and multicast sends stream medium data to the client that broadcast mode need switch simultaneously, client guarantees that the flow media data packet that receives repetition just sends the adding success message or withdraws from success message to streaming media server, not frame losing, not frame-skipping are switched in assurance, the problem of the interruption that may occur in the existing streaming media playing clean culture of solution, the multicast handoff procedure, hysteresis, frame-skipping realizes streaming media playing clean culture, multicast seamless switching.
Description of drawings
Sequential chart when Fig. 1 clean culture switches to multicast;
Sequential chart when Fig. 2 multicast switches to clean culture.
Embodiment
A kind of streaming media playing clean culture seamless switching of realizing becomes the method for multicast, and as Fig. 1, concrete steps are as follows:
1), streaming media server asks the client of same stream medium data to send the order of multicast group address, port information and adding multicast group to all; And
Streaming media server simultaneously sends stream medium data in the mode of clean culture and multicast to old client, in the mode of multicast to new client transmission stream medium data;
Wherein, described old client was meant before receiving described adding multicast group command by the client of mode of unicast from described streaming media server receiving stream media data; Described new client is meant the client except old client in the client of the same stream medium data of the described streaming media server request of forward direction.
2), the stream medium data that sends in the mode of clean culture of old client receiving stream media server, and according to the multicast group address that receives, port information, adding multicast group command, add the multicast group, intercept the port of appointment, the stream medium data that the receiving stream media server sends in the multicast mode, whether inspection has repetition by the stream medium data that multicast and mode of unicast receive: if having, then abandon the flow media data packet of repetition, the co-current flow media server sends and adds success message; If no, then do not send the adding success message to streaming media server;
In the present embodiment, to receive port that multi-case data uses consistent with the port that old client receives the unicast data use for old client;
After the order of new client according to the multicast group address that receives, port information, adding multicast group, add the multicast group, intercept the port of appointment, the stream medium data that the receiving stream media server sends in the multicast mode, co-current flow media server send and add success message;
3), if described streaming media server receives the described adding success message that described client sends in the regulation duration, then described streaming media server stops to send stream medium data in the mode of clean culture to clients corresponding, and only the mode with multicast sends stream medium data to described clients corresponding.
If described streaming media server does not receive the described adding success message that described client sends in the regulation duration, then described streaming media server sends a query statement to clients corresponding, check described clients corresponding state, if do not receive receiveing the response of described clients corresponding, then described clients corresponding is deleted from the multicast group, no longer send stream medium data to described clients corresponding.
A kind of streaming media playing multicast seamless switching of realizing becomes the method for clean culture, and as Fig. 2, concrete steps are as follows:
1), streaming media server sends the multicast group address, withdraws from the order of multicast group to the client of the same stream medium data of current request; And
Streaming media server sends stream medium data in the mode of clean culture and multicast to described client simultaneously;
2), described client receives the stream medium data that the mode with multicast sends, and according to the multicast group address, the port information that receive, withdraw from the multicast group command, withdraw from the multicast group, use the port multiplex technique, intercept the port of appointment, the stream medium data that the receiving stream media server sends in the mode of clean culture, whether inspection has repetition by the flow media data packet that multicast and mode of unicast receive: if having, then abandon the flow media data packet of repetition, withdraw from the multicast group, the co-current flow media server sends and withdraws from success message; If no, then do not withdraw from success message to the streaming media server transmission;
3), if described streaming media server receives the described success message that withdraws from that described client sends in the regulation duration, then described streaming media server stops to send stream medium data in the mode of multicast to clients corresponding, discharge multicast group resource, only the mode with clean culture sends stream medium data to clients corresponding.
If described streaming media server does not receive the described success message that withdraws from that described client sends in the duration of regulation, then described streaming media server sends a query statement to clients corresponding, check the state of described clients corresponding, if do not receive receiveing the response of described clients corresponding, then described clients corresponding is deleted from the multicast group, no longer send stream medium data to described clients corresponding.
Above-described embodiment of the present invention does not constitute the qualification to protection range of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within the claim protection range of the present invention.