A method of the TCP mode transfer audio and video data streams based on DSS time-sharing system
Technical field
The present invention relates to the operations that audio and video data streams are transmitted by TCP mode under DSS frame, are more specifically related to
The method of TCP mode transfer audio and video data streams based on DSS time-sharing system.
Background technique
Darwin Streaming Server abbreviation DSS.DSS is that the open source real time flow medium that Apple company provides plays
Server program, entire program are write using pure C++, and it is former to follow the programmings such as high-performance, simple, modularization in design
Then, must accomplish that program is efficient, expandability is good, therefore DSS server system be in cross-platform support it is quite ideal,
It may operate in the windows kernel version of Windows NT, 2000 Windows or more, while good can also run
In the various versions of * NIX, including the measured Streaming Media of Mac OS X, Linux, FreeBSD, Solaris, while DSS
Agreement RTSP, RTP/RTCP is developed, therefore has extremely strong popularity and versatility with upper.
On this basis, DSS Frame Design is more complicated at one, the relatively clear streaming media server of hierarchical structure
System, mainly by basic function component, (network, string processing, memory open up release, module tool, and internal error message is determined
Justice, global catalog etc.), each subsystem (RTSP, RTP, RTCP etc.), various feature card (authentication, identity
Authorization, data flow pretreatment, Data Stream Processing, the processing of the tunnel HTTP, server message reply etc.) it is composed, Hen Duokai
Hair personnel mainly will do it the exploitation of various feature cards, dynamically load be carried out when server starting, when main flow shape
Corresponding plug-in unit will be called when the processing of state machine is to corresponding state, server gives control to plug-in unit and carries out corresponding function at this time
It can running.Therefore, on this basis from the angle for using structure, server is divided into two bulks, server internal with
And outside server, server internal is made of various basic function components and subsystem, by feature card outside server
It forms, the interaction of data and the reality of basic function is carried out by the api interface that function pointer is designed between the two parts
It is existing.
However, original DSS frame is using UDP(User Datagram Protocol in audio and video data streams transfer and reflection
View) mode realizes, and is the realization of great demonstration effect, therefore original DSS frame is not almost available in Practical Project
Among project.More bad is that DSS frame has also stopped supporting no longer to update, if necessary to use original DSS frame
The transmission process that UDP mode carries out data flow must solve the problems, such as following big:
1:NAT(network address translation) it penetrates, when the RTSP(real time streaming transport protocol based on TCP mode) active transmission asks
It asks after completing RTSP interaction success toward audio-video source, the port negotiated by RTSP is started to transmit for the first time by audio-video to be based on
Toward server NAT problem will occur at this time for the RTP/RTCP data packet of UDP, and NAT has 4 kinds of different modes, therefore wants needle
4 kinds of different modes are handled, does not have to consider NAT problem if using the transmission based entirely on TCP mode, is located at routing
Transmission channel, RTP/RTCP bit stream data and net will be got through after RTSP client active transmission on the subsequent server of device
Network control data will be also transmitted along this channel;
The characteristics of 2:ReliableRTP, the bit stream based on UDP will inherit transport layer UDP, there are packet loss, random orderings etc.
Unreliable characteristic, it is therefore desirable to which server completes sequence number detection, and sequence number unrolls, if exceeded to the judgement of series number desired value
It then needs to carry out packet loss or other movements, resequences to data packet and carry out the reliable RTP transport behavior such as framing, these processing
Considerably increase the complexity of server exploitation;
3:Congestion Control(congestion control), UDP is not the agreement of a flow close friend, it does not have
Advertised window and sliding window in TCP, therefore UDP can not carry out transmitting terminal or receiving end flow control, but ceaselessly
A large amount of audio, video data packet is sent into network, gently then causes video very Caton, it is heavy then sending network congestion leads to same item
Routing paralysis.And if the congestion control mechanism difficulty to complete comparative maturity based on UDP is quite big.
4: server architecture difficult management, audio video transmission protocol RTP/RTCP based on UDP are needed to video flowing and sound
Frequency stream is separately turned on 2 receiving ports, comes to 4 progress code stream receptions, for clothes when only several audio-video sources
Device system resource of being engaged in influences less, but often has thousands of a sources up to a hundred in practical engineering project, is by largely expending
Resource of uniting and the great difficulty of generation when carrying out Service control, once preconsolidation stress is bad, the later period can not almost be pushed away
Income mesh.
In view of this, various problems existing for the DDS server characteristics and use UDP mode of the present invention in summary,
The detailed design method of the TCP mode transfer audio and video data streams based on DSS time-sharing system.
Summary of the invention
The TCP mode transfer audio and video data streams based on DSS time-sharing system that it is an object of the present invention to provide a kind of
Method, evaded NAT problem, improved the stability of audio and video data streams transfer, occupied server resource and reduce, sound view
Frequency is more smooth according to transmitting.
To achieve the goals above, technical scheme is as follows:
A method of the TCP mode transfer audio and video data streams based on DSS time-sharing system, comprising the following steps:
Step 1 is based on DSS Frame Design TCP transfer plug-in unit, turns design registration role in plug-in unit, initialization angle in tcp
Color, RTSP filtering role, RTSP routing role, RTSP submit processing role and close role, turn to design in plug-in unit in tcp
Each role is the module in the plug-in unit with high cohesion, lower coupling, and all roles are called in protocol analysis main flow, wherein
Registration role is for registering when all functional roles to be had in anterior plug-in, and initialization role is for initializing when anterior plug-in needs
The data structure and starting RTSP client task to be used, RTSP filtering role are for filtering active user's request instruction
No is HTTP tunnel style, and RTSP routing role is used to relocate the purpose of active user's request, RTSP submit processing role and
It closes role and closes role for handling and replying active user's request instruction, RTSP and asked for closing/dischargeing active user
Ask instruction process and resource;
Step 2 is based on DSS Frame Design TCP reflecting module plug-in unit, and the register initial in TCP reflecting module plug-in unit
Role reads configuration file role, RTSP routing role, RTSP pre-processing role, RTSP bit stream data role, client session again
It closes role, close role and RTSP authentication role;Wherein initialization role is used to register to work as all in anterior plug-in to be had
Functional role, RTSP routing role are used to relocate the purpose of active user's request, and RTSP pre-processing role is for prejudging
Whether active user's request is legal, and RTSP bit stream data role is for handling RTP/RTCP data flow, client session
Role is closed for closing/discharging client request connection procedure and resource, role is closed and is used to work as in server end closing
Preceding user requests the RTSP process of connection, RTSP authentication role be used for when server profile is provided with authentication to
Family request connection carries out authentication;
TCP transfer plug-in unit drains audio-video source according to data storage file, transfers audio-video source to server, when
When server captures audio and video data streams, TCP reflective inserts are triggered;The data storage file comes from database;
Step 4:TCP reflecting module plug-in unit is when server captures audio and video data streams, to corresponding with user's request
Audio and video data streams in database are reflected, to complete audio and video data streams transfer.
Preferably, the task design of all module roles is non-obstruction in TCP transfer plug-in unit and TCP reflecting module plug-in unit
Type.
Preferably, before step 3 after the step 2 further include: DSS Frame Design database plug-in unit is based on, in number
According in reading database in the initialization role in the plug-in unit of library audio-video source and transfer purpose relevant information be stored in and work as
In the address space of preceding program.
Preferably, in the step 3, TCP transfer plug-in unit drains audio-video source according to data storage file, by sound
Video source transfers server to, specifically includes:
TCP transfer plug-in unit is executing initialization role module, and beginningization role creation RTSP data source queue is for storing sound
Video source initializes TCP transfer session, and the module attribute knot of the unified configuration of system is inserted into using current block as an attribute
In structure body, the audio-video source and transfer purpose relevant information in caching are read;
Initialization role in TCP transfer plug-in unit, which check whether to the queue of RTSP data source, had been set up drainage
Link no longer carries out data drainage if having built up, was obtained if not establishing by the element in RTSP data source
RTSP data source information class is taken, starting conversation establishing task starts to create the progress audio-video source drainage of RTSP client task.
Preferably, the user specifically includes in RTSP client to the TCP transfer plug-in unit process of filing a request:
User is carried out in RTSP client using the RTSP mode of standard
Selection instruction and description instruction, selection instruction do not send probe instructions, and description instruction will solve the SDP protocol package received
Analysis obtains the stream information that current device source has;
SDP information is stored in local SDP file;
Turn the Describe instruction interaction mistake during the RTSP client of the initialization module starting in plug-in unit in tcp
Create transfer session and reflection session in journey after successfully resolved SDP protocol data in description instruction process, it is anti-in creation
It penetrates in session and opens up the information space for all Media Streams having in current device source, create corresponding RTP sender and RTCP
Sender;
When the success of TCP transfer conversation establishing, then prepares to start transfer task, each output purpose is added to corresponding defeated
TCP transfer output is carried out in stream out, every stream corresponds to multiple transfer purposes;
Task is declared into starting TCP transfer in transferring out in tcp, time sheet mode is used to the driving of this task,
A task call is carried out every the timeslice not less than 10 milliseconds, transmittable data packet team will be emptied during calling task
Column;
SETUP instruction phase in RTSP interactive process, audio-video source carry out transmission negotiation using TCP transmission mode,
Play instruction commander's audio & video equipment is finally sent to start to send data flow;
In playing process during the permanent loops of reading media stream function, invalid packets are carried out to jump out processing,
To jump out RTSP client process;
Media stream data packet during the RTSP client started in initialization module in TCP transfer plug-in unit handles letter
Number is RTP RTCP type for each data packet judgement handled well, calls the UDP created in starting reflection session respectively
Socket class is converted to TCP reflection socket feeding data packet processing function and is handled, and data packet handles function will be to data
Packet enters in the transmission data packet queue of corresponding sender, this queue will be adjusted in the TCP transfer declaration task of output
With.
Further, it when reading media stream function exits, needs to return to a time value in the end of playing process and carries out
The automatic calling of RTSP client task operates, which cannot be below 10 milliseconds;
It is further: during creating TCP transfer output, to be sent out according to the transfer purpose in database or configuration file
It send RTSP extended instruction to declare process, the transfer purpose of reflector server is declared, and declare that instruction is hung
LocalSDP protocol data, tell reflector server will active transmission bit stream data information, declaration instruction also by carry identify
The unique identifier of current video source code stream;
After declaring instruction process successful execution, all data flows that current transfer session carries are recycled, take out every stream
In corresponding TCP reflect sender, call reflection packet function to start to carry out transfer transmission, the TCP reflection sender is right respectively
Answer RTP sender/RTCP sender.
Further, the voice data stream for carrying out transfer transmission does not need to carry out buffer setting, but by transfer audio number
It calls directly in reflection and subcontracts according to stream, subcontracted in reflection and take out barrelage amount all under every stream in function, circulation is every in bucket
A index takes out all transfer queues and starts to be sent, and for each transmission purpose, sends out the institute in data packet queue
Some data packets.
Further, it will be called in RTSP client when executing and sending packet function when TCP transfer is exported
PutMediaPakcet function, when this function return value and be not equal to OS_NoErr when, return value is arranged to QTSS_
WouldBlock, bookmark setting will be carried out to the data packet that this blocks by subcontracting function back in reflecting at this time, under
Bookmark packet will be first looked for when primary progress TCP reflection RelayPackets to be sent.
Further, when TCP transfer plug-in unit successfully carries out transfer and active push declaration instruction to audio-video source data
When to TCP reflecting module, server will execute pre-registered corresponding role module in TCP reflecting module module;?
The RTSP instruction interaction stage, RTSP when receiving the declaration instruction that transit module sends in TCP reflecting module located in advance
Reason role's role module will work, and save the SDP message carried in declaration instruction in local file.
Further, RTSP when TCP transfer card module, which sends enabled instruction, to come, in TCP reflecting module
Pre-processing role role module will trigger DoSetup function, this function will judge the mark for whether needing to push in enabled instruction
Will is either sent in destination queue for determining to be added in client session, if this is the stream of declaration instruction, is created
TCP reflection session is built, and this session is stored into the sClientBroadcastSessionAttr of client session;
If this is the enabled instruction that a user terminal connection is come in, illustrate that this user terminal is reflected as one
Purpose needs to be reflected stream, therefore creates TCPRTP reflection purpose session and be added in TCP reflection session;
If this is the session come in by the instruction of declaration beginning, by this stream before starting TCP reflection session
It is arranged to the conversation type for needing to cache;
If this is that a user terminal session is come in, will be apparent that when DoSetup, there is this to use
The session identification to be requested of family terminal, the FindOrCreateSession function in DoSessionSetup, which will be seen that, have been deposited
In queued session, if successfully finding queued session this user terminal session being added to Output, will to carry out data flow anti-
It penetrates.
Further, in FindOrCreateSession function call creation TCP reflection session function, for
The pairing of CreateUDP socket comments out the UDP address multiplex process in former DSS frame under TCP mode, otherwise this process
It will lead to the Article 2 Media Stream SSRC under TCP mode to clash.
Further, when TCP transfer plug-in unit successfully drains and the past reflection service of active push ANNOUNCE instruction process
Device successfully creates reflection session, then starts to send audio-video code stream data, will trigger the RTSP code stream in TCP reflecting module at this time
Data role's role module is started to work, this role module will call PushPacket function, distinguishes RTP/RTCP data packet
Toward corresponding user terminal;
PushPacket will trigger the Run task in TCP reflection socket class, this task design is at IdleTask type
Task the priority processing external world is connected when the connection with outer is come in, server thread pond is without any other
The lasting push of code stream is just carried out when business;
TCP reflective inserts will discern whether had when end user sends with selection instruction connection type
The code stream identification for thering is end user to request, if the code stream session for needing to request is had existed, using end user as one
Output order adds.
Preferably, in the drainage, transfer and reflection process, regardless of whether the access with user terminal, drainage is in
Turn over Cheng Chixu progress.
After adopting the above scheme, the beneficial effects of the present invention are:
One, do not have to consider NAT problem using TCP mode transfer, the RTSP client on the subsequent server of router
Transmission channel will be got through after the active transmission request of end, RTP/RTCP bit stream data and network control data also will be along these
Channel is transmitted;
Two, packet loss, out-of-order problem are avoided;
Three, a large amount of audio, video data packet can be transmitted by TCP, is not in send network congestion to lead to same item routing paralysis
The case where paralysis, or even the phenomenon that prevented Caton;
Four, server demands degree is reduced, saves server system resources, promote Service control efficiency.
Below in conjunction with the drawings and specific embodiments, the present invention will be further described.
Detailed description of the invention
Fig. 1 is present invention drainage, and overview flow chart is reflected in transfer.
Fig. 2 is the first procedure chart of transfer process.
Fig. 3 is the second procedure chart of transfer process.
Fig. 4 is transfer process third procedure chart.
Fig. 5 is the 4th procedure chart of transfer process.
Fig. 6 is reflection the first procedure chart of process.
Fig. 7 is reflection the second procedure chart of process.
Fig. 8 is user terminal requests procedure chart.
Specific embodiment
As shown in Figure 1, a kind of TCP mode transfer audio and video data streams based on DSS time-sharing system that the present invention discloses
Method, comprising the following steps:
Step 1 is based on DSS Frame Design TCP transfer plug-in unit, turns design registration role in plug-in unit, initialization angle in tcp
Color, RTSP filtering role, RTSP routing role, RTSP submit processing role and close role, turn to design in plug-in unit in tcp
Each role is the module in the plug-in unit with high cohesion, lower coupling, and all roles are called in protocol analysis main flow, wherein
Registration role is for registering when all functional roles to be had in anterior plug-in, and initialization role is for initializing when anterior plug-in needs
The data structure and starting RTSP client task to be used, RTSP filtering role are for filtering active user's request instruction
No is HTTP tunnel style, and RTSP routing role is used to relocate the purpose of active user's request, RTSP submit processing role and
It closes role and closes role for handling and replying active user's request instruction, RTSP and asked for closing/dischargeing active user
Ask instruction process and resource;
Step 2 is based on DSS Frame Design TCP reflecting module plug-in unit, and the register initial in TCP reflecting module plug-in unit
Role reads configuration file role, RTSP routing role, RTSP pre-processing role, RTSP bit stream data role, client session again
It closes role, close role and RTSP authentication role;Wherein initialization role is used to register to work as all in anterior plug-in to be had
Functional role, RTSP routing role are used to relocate the purpose of active user's request, and RTSP pre-processing role is for prejudging
Whether active user's request is legal, and RTSP bit stream data role is for handling RTP/RTCP data flow, client session
Role is closed for closing/discharging client request connection procedure and resource, role is closed and is used to work as in server end closing
Preceding user requests the RTSP process of connection, RTSP authentication role be used for when server profile is provided with authentication to
Family request connection carries out authentication;
TCP transfer plug-in unit drains audio-video source according to data storage file, transfers audio-video source to server, when
When server captures audio and video data streams, TCP reflective inserts are triggered;The data storage file comes from database;
Step 4:TCP reflecting module plug-in unit is when server captures audio and video data streams, to corresponding with user's request
Audio and video data streams in database are reflected, to complete audio and video data streams transfer.
The following are the detailed transfer processes of the present embodiment:
It is illustrated in figure 2 creation and the method function calling process of the procedure chart class of transfer process first part, TCP transfer
Plug-in unit can store the address information of audio-video source and transfer purpose information during carrying out initialization role module
Into in video source message queue, by calling session to search function come the discovery that conversates, if the address in queue has been built
It erects session then to return, passes through the meeting in TCPRTSP audio-video source info class if the address in queue does not also set up session
The socket process of words creation mission function creation drainage session, is ready to carry out and appoints to audio-video source progress code stream receive process
Business.This task execution function will trigger the RTSP instruction flow of series of standards, hand over when successfully having carried out DESCRIBE instruction
After mutual process, the analytical function method in SDPSourceInfo class will be called to carry out the SDP protocol data packet received
Parsing, the stream information that analyzing current audio-video source has are saved, then using the SDP information of current audio-video source as ginseng
Number passes to TCP transfer conversation class, calls SetupTCP transfer session function, finally creates Output according to transfer destination address
Transfer is added in current transfer session;
It is illustrated in figure 3 the second process of transfer process, TCP transfer session is inherited from the reflection conversation class of DSS, therefore is building
In vertical TCP transfer session function other than carrying out some routines and creating module process, it will mainly call and start reflection session letter
Number works, and the SDP protocol data packet being passed to before is created TCP contrajet class by starting reflection session, then calls
BindSockets creates critically important transfer socket, and sender's manager and SSRC indicate, in the present invention, for transfer
The structural approach that socket transmits the UDP mode data adopted in former DSS frame, but as just a structural framing
The transmission mode for clearly showing every kind of data flow under TCP mode will be to sound in the case where the UDP mode of original DSS frame is transmitted
A pair of matched UDP socket pairing of every Stream creation possessed by video source, respectively corresponds the RTP and RTCP currently flowed
Data, equally, in the present invention, TCP mode, which is transmitted, will also continue to use this logical level structure, match having created UDP socket
Sender's structure will be created to later, corresponding to, and be added in the contrajet class of current DSS frame, in bound socket
The last one important step of function will be to every specific data flow (RTP or RTCP in video flowing, in audio stream
RTP or RTCP) the corresponding SSRC unique identifier of creation;
It is illustrated in figure 4 transfer process third process, sends creation transfer purpose after creating transfer session success
Task, this task will actively run oneself for the first time and create reflection packet function opens up packet in advance, then starts to transfer mesh
Transmission ANNOUNCE instruction process and reflector server set up connection.
It is illustrated in figure 5 the Four processes of transfer process, 7: after turning over journey among the above and all establishing, RTSP visitor
Family end (towards audio-video source, the Output task in transfer will be towards reflector server), which will continue to be advanced to PLAY, to be instructed
Journey, this process will start the Media Stream of reception audio-video source, and reading media stream function will execute this work, wherein main adjust
The RTP/RTCP data packet that corresponding audio/video flow in Media Stream is obtained with GetMediaPacket, for each successful number
According to packet, the reflection packet function data packet opened up in advance under corresponding Stream will be called, copy is entered, at this point for connecing
The data received have passed through memory and have copied among transfer session, until the arrival of transfer Session Time piece, will start to push
To transfer purpose;
The following are the present embodiment to reflect process in detail:
Be illustrated in figure 6 reflection the first process of process: reflector server (transfer destination server) receives ANNOUCNE
The entrained SDP protocol data of this instruction will be saved after instruction in local file, is then received and is transmitted across by transfer server
Whether the SETUP instruction judgement come is currently the session for needing push, and transfer session is that the session for needing push to go out then is established
Reflect session, the process of creation is similar with transfer session, with being to need to cache bit stream data, if it is with
Family terminal session is then the session for not needing push, is associated with whether has existed queued session mark at this time, if present
It is then added to reflection output, 401 resources is then returned if there is no and if does not find mistake;
It is illustrated in figure 7 reflection the second process of process: RTSP bit stream data role role's mould in TCP reflecting module plug-in unit
Block will be triggered calling when main flow receives Media Stream, without entering in RTSP pre-processing role process, because
This this role module is the module for handling physical medium data flow, and whether module will parse media data packet correct, and
Task starting operation in time in system identifier LE in driving reflection packet function.Finally corresponding media data flow is reflected to
Corresponding terminal user.
Preferably, the task design of all module roles is non-obstruction in TCP transfer plug-in unit and TCP reflecting module plug-in unit
Type.
Preferably, before step 3 after the step 2 further include: DSS Frame Design database plug-in unit is based on, in number
According in reading database in the initialization role in the plug-in unit of library audio-video source and transfer purpose relevant information be stored in and work as
In the address space of preceding program.
Preferably, in the step 3, TCP transfer plug-in unit drains audio-video source according to data storage file, by sound
Video source transfers server to, specifically includes:
TCP transfer plug-in unit is executing initialization role module, and beginningization role creation RTSP data source queue is for storing sound
Video source initializes TCP transfer session, and the module attribute knot of the unified configuration of system is inserted into using current block as an attribute
In structure body, the audio-video source and transfer purpose relevant information in caching are read;
Initialization role in TCP transfer plug-in unit, which check whether to the queue of RTSP data source, had been set up drainage
Link no longer carries out data drainage if having built up, was obtained if not establishing by the element in RTSP data source
RTSP data source information class is taken, starting conversation establishing task starts to create the progress audio-video source drainage of RTSP client task.
Preferably, the user specifically includes in RTSP client to the TCP transfer plug-in unit process of filing a request:
User is carried out in RTSP client using the RTSP mode of standard
Selection instruction and description instruction, selection instruction do not send probe instructions, and description instruction will solve the SDP protocol package received
Analysis obtains the stream information that current device source has;
SDP information is stored in local SDP file;
Turn the Describe instruction interaction mistake during the RTSP client of the initialization module starting in plug-in unit in tcp
Create transfer session and reflection session in journey after successfully resolved SDP protocol data in description instruction process, it is anti-in creation
It penetrates in session and opens up the information space for all Media Streams having in current device source, create corresponding RTP sender and RTCP
Sender;
When the success of TCP transfer conversation establishing, then prepares to start transfer task, each output purpose is added to corresponding defeated
TCP transfer output is carried out in stream out, every stream corresponds to multiple transfer purposes;
Task is declared into starting TCP transfer in transferring out in tcp, time sheet mode is used to the driving of this task,
A task call is carried out every the timeslice not less than 10 milliseconds, transmittable data packet team will be emptied during calling task
Column;
SETUP instruction phase in RTSP interactive process, audio-video source carry out transmission negotiation using TCP transmission mode,
Play instruction commander's audio & video equipment is finally sent to start to send data flow;
In playing process during the permanent loops of reading media stream function, invalid packets are carried out to jump out processing,
To jump out RTSP client process;
Media stream data packet during the RTSP client started in initialization module in TCP transfer plug-in unit handles letter
Number is RTP RTCP type for each data packet judgement handled well, calls the UDP created in starting reflection session respectively
Socket class is converted to TCP reflection socket feeding data packet processing function and is handled, and data packet handles function will be to data
Packet enters in the transmission data packet queue of corresponding sender, this queue will be adjusted in the TCP transfer declaration task of output
With.
Further, it when reading media stream function exits, needs to return to a time value in the end of playing process and carries out
The automatic calling of RTSP client task operates, which cannot be below 10 milliseconds;
It is further: during creating TCP transfer output, to be sent out according to the transfer purpose in database or configuration file
It send RTSP extended instruction to declare process, the transfer purpose of reflector server is declared, and declare that instruction is hung
LocalSDP protocol data, tell reflector server will active transmission bit stream data information, declaration instruction also by carry identify
The unique identifier of current video source code stream;
After declaring instruction process successful execution, all data flows that current transfer session carries are recycled, take out every stream
In corresponding TCP reflect sender, call reflection packet function to start to carry out transfer transmission, the TCP reflection sender is right respectively
Answer RTP sender/RTCP sender.
Further, the voice data stream for carrying out transfer transmission does not need to carry out buffer setting, but by transfer audio number
It calls directly in reflection and subcontracts according to stream, subcontracted in reflection and take out barrelage amount all under every stream in function, circulation is every in bucket
A index takes out all transfer queues and starts to be sent, and for each transmission purpose, sends out the institute in data packet queue
Some data packets.
Further, it will be called in RTSP client when executing and sending packet function when TCP transfer is exported
PutMediaPakcet function, when this function return value and be not equal to OS_NoErr when, return value is arranged to QTSS_
WouldBlock, bookmark setting will be carried out to the data packet that this blocks by subcontracting function back in reflecting at this time, under
Bookmark packet will be first looked for when primary progress TCP reflection RelayPackets to be sent.
Further, when TCP transfer plug-in unit successfully carries out transfer and active push declaration instruction to audio-video source data
When to TCP reflecting module, server will execute pre-registered corresponding role module in TCP reflecting module module;?
The RTSP instruction interaction stage, RTSP when receiving the declaration instruction that transit module sends in TCP reflecting module located in advance
Reason role's role module will work, and save the SDP message carried in declaration instruction in local file.
Further, RTSP when TCP transfer card module, which sends enabled instruction, to come, in TCP reflecting module
Pre-processing role role module will trigger DoSetup function, this function will judge the mark for whether needing to push in enabled instruction
Will is either sent in destination queue for determining to be added in client session, if this is the stream of declaration instruction, is created
TCP reflection session is built, and this session is stored into the sClientBroadcastSessionAttr of client session;
If this is the enabled instruction that a user terminal connection is come in, illustrate that this user terminal is reflected as one
Purpose needs to be reflected stream, therefore creates TCPRTP reflection purpose session and be added in TCP reflection session;
If this is the session come in by the instruction of declaration beginning, by this stream before starting TCP reflection session
It is arranged to the conversation type for needing to cache;
If this is that a user terminal session is come in, will be apparent that when DoSetup, there is this to use
The session identification to be requested of family terminal, the FindOrCreateSession function in DoSessionSetup, which will be seen that, have been deposited
In queued session, if successfully finding queued session this user terminal session being added to Output, will to carry out data flow anti-
It penetrates.
Further, in FindOrCreateSession function call creation TCP reflection session function, for
The pairing of CreateUDP socket comments out the UDP address multiplex process in former DSS frame under TCP mode, otherwise this process
It will lead to the Article 2 Media Stream SSRC under TCP mode to clash.
Further, when TCP transfer plug-in unit successfully drains and the past reflection service of active push ANNOUNCE instruction process
Device successfully creates reflection session, then starts to send audio-video code stream data, will trigger the RTSP code stream in TCP reflecting module at this time
Data role's role module is started to work, this role module will call PushPacket function, distinguishes RTP/RTCP data packet
Toward corresponding user terminal;
PushPacket will trigger the Run task in TCP reflection socket class, this task design is at IdleTask type
Task the priority processing external world is connected when the connection with outer is come in, server thread pond is without any other
The lasting push of code stream is just carried out when business;
TCP reflective inserts will discern whether had when end user sends with selection instruction connection type
The code stream identification for thering is end user to request, if the code stream session for needing to request is had existed, using end user as one
Output order adds.
Preferably, in the drainage, transfer and reflection process, regardless of whether the access with user terminal, drainage is in
Turn over Cheng Chixu progress.
The above is only specific embodiments of the present invention, not to the restriction of protection scope of the present invention.All setting according to this case
The equivalent variations that meter thinking is done, each falls within the protection scope of this case.