A kind of transfer method of multicasting based on Darwin's streaming media server
Technical field
The present invention relates to computer communication field, more particularly to a kind of transfer multicast based on Darwin's streaming media server
Method.
Background technology
Existing streaming media server there are the problem of have it is following some:
1)The existing streaming media server for possessing transfer multicast-capable uses the multicast mode based on client access, i.e., a kind of quilt
The dynamic RTSP (real time streaming agreement) that receives is instructed and the mode of active push audio and video data streams.But in real enterprise
Camera resource more than ten million rank of access is generally required in the use of level, substantial amounts of code stream is distributed and is supplied to different work(
Energy server carries out the processing of difference in functionality, is that one kind active push RTSP (real time streaming agreement) in interaction is instructed
And the mode of active push audio and video data streams;Such as active push refers to storage server RTSP (real-time stream media protocol)
Order, then active push is stored to storage server audio-video code stream, and procedure below is identical, analyzes streaming server, real
When broadcast code flow server etc., while the requirement fort machine that computer room construction grade is 1 grade, it is standby that the presence of backup machine carries out hot-swap
Part is so as to reach fault-free, seamless system level, as described above, often having a variety of different processing sides for a code stream
, it is necessary to which transfer server single channel drains, multichannel forwards case, therefore it is necessary, and current to carry out multicast in this stage
Several real time flow medium Play Server programs of increasing income, DarwinStreamServer, Live555Server and libVLC
Development library is not carried out the Announce instruction mode multicasts under RTSP agreements, and result in enterprise-level is needed very using upper
Substantial amounts of rack server and the very various cost resources such as the network interface card of high bandwidth, core switch are arranged, and are increased
Computer room construction, the complexity and later maintenance cost of comprehensive wiring, and under with 30*24 preconditions, such high flow capacity
Long-play certainly will occur it is various be difficult to expect unstable, packet loss, shake.
2)Existing switch, router device supports IGMP agreements, possesses multicast functionality, without realizing multicast functionality
System arrangement virtually waste substantial amounts of resource.
3)Server distribution mode under existing unicast (unicast) mode, needs to be diverted to 5 if there is 1000
The system arrangement demand of function server, then need carry out 1000 × 5(The i.e. every link sum number for having 5 the same functions
According to bag))Link and data traffic, and more parts that substantial amounts of identical data packet is filled with this premise lower network are copied
Shellfish, it is heavy that substantial amounts of redundant data causes network burden, and delay length, network congestion is even collapsed.
4)So that All hosts are required to receive a identical data packet in network under existing Broadcast (broadcast) mode
Replicate, equally exist substantial amounts of redundant data and cause network burden quite heavy, postpone, it is crowded even to collapse.
The content of the invention
It is an object of the invention to provide a kind of transfer method of multicasting based on Darwin's streaming media server, the present invention are logical
Cross and Darwin's streaming media server is divided into two parts deployment, change original Darwin's streaming media server and only support in unicast
The scheme turned, realizes transfer multicast, in transfer process using announce as forwarding purpose quantity statistics, can determine whether that forwarding address is
It is no multicast address and to can determine that whether audio/video flow forwarding address can be saved in transfer server, also realize code stream all the way
Multichannel forwards, and greatly alleviates network bandwidth and network traffics, takes full advantage of the multicast functionality of the network hardware.
To reach above-mentioned technical purpose, technical scheme is as follows:
A kind of transfer method of multicasting based on Darwin's streaming media server, comprises the following steps:
The first step, divide two parts to dispose Darwin's streaming media server executable file, Ruo Daer Streaming Media text servers
Turn to indicate that property value is true in configuration file or Database field, then it is transfer server to define Darwin's server,
If the configuration file or Database field transfer flag property of Darwin's server are false, Darwin service is defined
Device is reception reflector server;This step purpose is that former Darwin's streaming media server is divided into two parts deployment, from remotely taking the photograph
Camera drainage portion is defined as transfer server, receives interim data stream and reflection corresponding data stream is determined to the part of client
Justice is reception reflector server;
Second step, initialize its module or plug-in unit with transfer and forwarding capability in transfer server start-up course;
It can be initialized first in Darwin's streaming media server start-up course with transfer, the module or plug-in unit of forwarding capability,
Therefore be defined as middle rotating function Darwin's streaming media server also have the function of it is the same;
In 3rd step, transfer server with forwarding capability module read first target video camera IP address, port numbers and
Universal resource locator (URL) in real time flow medium Data Transport Protocol (RTSP), transfer server and target shooting chain
After connecing, target video camera audio-video code stream data are obtained, and by being obtained in real time flow medium Data Transport Protocol interaction
The Session Description Protocol (SDP) of load obtains the session description file (the entitled .sdp of suffix) of target video camera;
4th step, in transfer server and target video camera link, there is the module of forwarding capability to read and receive server
In the real time streaming agreement that IP address, port numbers and forwarding use in the Uniform Resource Identifier of ANNOUNCE modes
Unique mark;Such as " live1.sdp ".Unique mark suffix name uniformly uses .sdp;ANNOUNCE modes are real-time streams matchmakers
One extended method of body transport protocol, its unique mark with Uniform Resource Identifier;
Then the purpose client information of ANNOUNCE links created is needed during reading real time streaming protocol forward;Institute
ANNOUNCE links are stated to establish using TCP modes;To ensure that the interactive instruction of real time streaming agreement is accurate, reliably send
Reach and reply;
5th step, the module with forwarding capability will be transmitted to reception reflection using real-time transport protocol reading audio-video code stream
The purpose IP address of server, this address are Class D IP address;That is multicast address;
6th step, with forwarding capability module read real time streaming agreement in ANNOUNCE forwarding address and
During audio-video code stream forwarding address, according to ANNOUNCE forwarding address quantity statistics transfer purpose quantity;
7th step, transfer server carry out drawing audio and video data streams with target video camera of real time streaming protocol link
For session unit, then create real time streaming protocol conversation and carry out link drainage;
Proceed to this interactive instruction of Describe when progress target video camera real time streaming protocol interaction command chain connects
During success, transfer conversation class is opened up(RelaySession), while call the establishment transfer session function in transfer server
SetupRelaySession (), which starts, creates transfer session;
After the instruction link process whole success of target video camera real time streaming protocol interaction is carried out, transfer class is opened up
(RelayOutput), startup transfer task (RelayAnnouncer) preparation will currently be introduced through the sound come from purpose video camera and regard
Frequency data stream is forwarded to reception reflector server, and the reception reflector server real time streaming protocol interaction of destination, is handed over
Mutual command sequence is Announce->Setup->Play->The sender of Teardown, wherein interactive instruction are that transfer is appointed
Be engaged in RelayAnnouncer;
8th step, when transfer task sends Announce instructions, the C IN in the Session Description Protocol of load:Field contents
It is worth for D class multicast address, i.e., the multicast address that audio, video data will be sent later, at transfer task (RelayAnnouncer)
When sending Setup instructions, the broadcast mode that receiving terminal is informed in instruction field is multicast mode;
9th step, the real time streaming agreement when interaction between transfer task and the reception reflector server of transfer destination
Success has interacted, and judges whether current transfer session can use, if it is available, then judging whether transfer destination address is multicast at the same time
Address and judge currently using a target video camera draw audio and video data streams as session unit current sessions whether
Through being established forwarding multicasting session, current transfer class is added in transfer server if the two conditions are set up at the same time
In unloading storage structure bucket, if current transfer address is not multicast address, for mode of unicast, then transfer address is all added
Into in transfer storage organization bucket, if it is determined that condition is all unsatisfactory for, then reacquires next transfer address and judged, and only
It could delete and be deleted in the case where transfer address is invalid.
Compared with prior art, the positive effect of the present invention is:
1st, Darwin's streaming media server transfer of the prior art, reflection process are a executable file, when transfer
For code stream is sent to itself, client is reflected to corresponding client again when access, this mode enterprise-level have into
Thousand a video cameras up to a hundred and need that code stream is carried out to limit under the scene of a variety of processing too big;
It is of the invention then to be divided into two parts to former Darwin's streaming media server be transfer server and reflector server, deployment
Mode is flexible, and scene is adaptable;
2nd, Darwin's streaming media server transfer process of the prior art only supports UDP mode of unicast, in this manner when need
The code stream of identical number N is needed to forward in the case of carrying out N kind function treatments to code stream all the way, to bandwidth and the network equipment
Pressure it is huge;
Multicast of the invention by realizing transfer process, realizes that code stream can be forwarded with N roads all the way, greatly reduces network traffics
Pressure, and take full advantage of hardware multicast ability in network;
3rd, Darwin's streaming media server of the prior art using in configuration file have destination mark field as turn
Send out purpose quantity statistics;
The present invention is instructed as forwarding purpose quantity statistics with the Announce in real-time stream media protocol, while judging to turn
Whether hair address is multicast address and whether has created multicast in units of a target video camera drainage session as condition
Whether set up so as to decide whether audio/video flow forwarding address being added to the original transfer caching of Darwin's streaming media server
In structure bucket (Bucket);
4th, Darwin's streaming media server of the prior art underway real-time stream media protocol (RTSP) process for turning over journey
The unicast modes under UDP transport protocols are only supported in Setup instructions, and the method for the present invention is supported under UDP transport protocols at the same time
Multicast multicast modes.
Therefore, Darwin's streaming media server is divided into two parts deployment by the present invention so that media data transmission can be more
To be reasonably distributed on different hardware servers, there is provided the server to difference in functionality is handled, and is made full use of at the same time
Exchange hardware equipment in video private network in the case where not increasing server network interface card uplink and downlink flow realizes code stream all the way
Multichannel transfer, greatly alleviates network bandwidth and network traffics, and deployment way is flexible, and scene is adaptable.
Below in conjunction with the drawings and specific embodiments, the invention will be further described.
Brief description of the drawings
Fig. 1 is the flow chart of existing transfer mode of unicast;
Fig. 2 is the transfer method of multicasting flow chart of the invention based on Darwin's streaming media server.
Embodiment
As shown in Fig. 2, a kind of transfer method of multicasting based on Darwin's streaming media server of the present invention, specifically includes as follows
Step:
The first step, divide two parts to dispose Darwin's streaming media server executable file, Ruo Daer Streaming Media text servers
Turn to indicate that property value is true in configuration file or Database field, then it is transfer server to define Darwin's server,
If the configuration file or Database field transfer flag property of Darwin's server are false, Darwin service is defined
Device is reception reflector server;This step purpose is that former Darwin's streaming media server is divided into two parts deployment, from remotely taking the photograph
Camera drainage portion is defined as transfer server, receives interim data stream and reflection corresponding data stream is determined to the part of client
Justice is reception reflector server;
Second step, initialize its module or plug-in unit with transfer and forwarding capability in transfer server start-up course;
It can be initialized first in Darwin's streaming media server start-up course with transfer, the module or plug-in unit of forwarding capability,
Therefore be defined as middle rotating function Darwin's streaming media server also have the function of it is the same;
In 3rd step, transfer server with forwarding capability module read first target video camera IP address, port numbers and
Universal resource locator (URL) in real time flow medium Data Transport Protocol (RTSP), transfer server and target shooting chain
After connecing, target video camera audio-video code stream data are obtained, and by being obtained in real time flow medium Data Transport Protocol interaction
The Session Description Protocol (SDP) of load obtains the session description file (the entitled .sdp of suffix) of target video camera;
4th step, in transfer server and target video camera link, there is the module of forwarding capability to read and receive server
In the real time streaming agreement that IP address, port numbers and forwarding use in the Uniform Resource Identifier of ANNOUNCE modes
Unique mark;Such as " live1.sdp ".Unique mark suffix name uniformly uses .sdp;ANNOUNCE modes are real-time streams matchmakers
One extended method of body transport protocol, its unique mark with Uniform Resource Identifier;
Then the purpose client information of ANNOUNCE links created is needed during reading real time streaming protocol forward;Institute
ANNOUNCE links are stated to establish using TCP modes;To ensure that the interactive instruction of real time streaming agreement is accurate, reliably send
Reach and reply;
5th step, the module with forwarding capability will be transmitted to reception reflection using real-time transport protocol reading audio-video code stream
The purpose IP address of server, this address are Class D IP address;That is multicast address;
6th step, with forwarding capability module read real time streaming agreement in ANNOUNCE forwarding address and
During audio-video code stream forwarding address, according to ANNOUNCE forwarding address quantity statistics transfer purpose quantity;
7th step, transfer server carry out drawing audio and video data streams with target video camera of real time streaming protocol link
For session unit, then create real time streaming protocol conversation and carry out link drainage;
Proceed to this interactive instruction of Describe when progress target video camera real time streaming protocol interaction command chain connects
During success, transfer conversation class is opened up(RelaySession), while call the establishment transfer session function in transfer server
SetupRelaySession (), which starts, creates transfer session;
After the instruction link process whole success of target video camera real time streaming protocol interaction is carried out, transfer class is opened up
(RelayOutput), startup transfer task (RelayAnnouncer) preparation will currently be introduced through the sound come from purpose video camera and regard
Frequency data stream is forwarded to reception reflector server, and the reception reflector server real time streaming protocol interaction of destination, is handed over
Mutual command sequence is Announce->Setup->Play->The sender of Teardown, wherein interactive instruction are that transfer is appointed
Be engaged in RelayAnnouncer;
8th step, when transfer task sends Announce instructions, the C IN in the Session Description Protocol of load:Field contents
It is worth for D class multicast address, i.e., the multicast address that audio, video data will be sent later, at transfer task (RelayAnnouncer)
When sending Setup instructions, the broadcast mode that receiving terminal is informed in instruction field is multicast mode;
9th step, the real time streaming agreement when interaction between transfer task and the reception reflector server of transfer destination
Success has interacted, and judges whether current transfer session can use, if it is available, then judging whether transfer destination address is multicast at the same time
Address and judge currently using a target video camera draw audio and video data streams as session unit current sessions whether
Through being established forwarding multicasting session, current transfer class is added in transfer server if the two conditions are set up at the same time
In unloading storage structure bucket, if current transfer address is not multicast address, for mode of unicast, then transfer address is all added
Into in transfer storage organization bucket, if it is determined that condition is all unsatisfactory for, then reacquires next transfer address and judged, and only
It could delete and be deleted in the case where transfer address is invalid.
Using above-mentioned transfer method of multicasting, following advantage can use to obtain:
Being drained all the way first, realizing and being distributed in Darwin's streaming media server processing stage in arrangement, multichannel forwarding becomes possible to,
Redundant hardware resource need not be increased.
Second, greatly reducing the data on flows in stream media network, a data, multiple copies are realized.
Third, system structure arrangement is succinct clean, problem investigation positioning is quick, is easily solved.
Fourth, make full use of the multicast-capable resource of interchanger, router hardware.