Two modes of real-time video forwarding in Easydarwin

Source: Internet
Author: User

First, the introduction of the Darwin development document to introduce a section of the circulation of the pull mode and push mode:

Darwin supports two types of automatic transmissions: first pull and then push. To initiate an automatic broadcast, the RTSP customer sends a standard RTSP request to request a stream from the server, and the server relays the stream to one or more streaming media servers. This scenario is described in the "Pull and push" section.
First listen and push. In this scenario, automatic transmissions are initiated when a streaming media server receives a announce request. This scenario is described in the "Listen first after push" section.

first Pull, then push .

A user can request a stream from a remote source by sending a standard Describe/setup/play request, and then relay it to one or more destinations. This feature may be useful when you want only one copy of the external stream to occupy the bandwidth of its internal connection. Relay forwarding Gets a copy of multiple copies and forwards, distributed to the requesting client. Figure 1 provides an example of a first-pull back-push (Pull-then-push) scenario.

Figure 1. first pull back push type

To Figure 1. As a reference, the steps to pull back the scene first are as follows: Streaming media Server A (forwarding server) sends a standard RTSP client Describe/setup/play request to a remote server, i.e. streaming media Server B.
The relay "client" (streaming media Server A) that initiates the request begins to accept the stream, and then sends the announce push request to all destinations listed in the relay configuration of the input stream.

Note: We often encounter in the actual requirements of the scene, the client's request triggers the forwarding server in pull mode from the front-end device or other streaming media server to obtain video, then transmitted to the client, is a pull back (pull-then-pull) mode, if the client requested the video stream exists, To forward the copies that have been obtained directly for distribution, which is what we need to do in two of the development of Darwin.

first listen and then push

A streaming media server can be configured to automatically send an input stream created by a announce request to one or more destinations. This may be used to configure an automatic broadcast network. Figure 2 provides an example of a scene that is first listening and then pushed.

Figure 2. first listen for the push-back

In Figure 2. As a reference, the following steps are taken to listen and then push the scene: The remote machine (Ipcamera, etc. front-end devices or relay servers) sends a announce request to streaming media Server A. Streaming media servers can accept or deny this request. If it accepts the request, the streaming media server checks the secondary configuration to determine if the stream should be relayed.
If the stream should be relayed, the streaming media server will send the standard RTSP client Describe/setup/play request to itself.
The requesting relay "client" (streaming media Server A) starts receiving the stream and sends a annouce request to all destinations listed in the relay configuration of the corresponding input stream.

Note: We are often encountered in the actual needs of the scene, front-end equipment RTSP announce online to relay server, reported its streaming media SDP information, front-end equipment after the ' triggered ', through the setup/play process to initiate the flow of push, the client and pull mode to pull real-time video streaming, is a first push pull (push-then-pull) mode, if the client requested the video stream exists, then directly forward the obtained copy for distribution, this is what we need to do in two of Darwin's development, "I say again."

By default, authentication is necessary for automatic transmissions. Announce requests from the transmitter need to be filtered through the active authentication mechanism in the server. In order to support the broadcast authentication, a new write instruction is added to the qtaccess file. This new instruction allows the SDP file to be written to the media folder (Movies folder in Darwin).

Ii. specific categories of implementation for forwarding and distribution in Darwin

In Darwin, the module that implements pull mode forwarding is Qtssrelaymodule, each forwarding session is a Relaysession object, and the forwarding list is stored in the queue Ssessionqueue

Qtssrelaymodule First Initialize () read configuration file about forwarding file paths are stored in srelayprefs static variables [HTML] view plain copy <module name= " Qtssrelaymodule "> <pref name=" relay_prefs_file ">./relayconfig.xml</PREF> <pref name=" RelA Y_stats_url "></PREF> </MODULE>

Configure and parse out the distribution list in Readrelayprefsfile () and srelayprefs the source configuration in each distribution configuration to create relaysessioncreator open distribution and add to Ssessionqueue , Rtspsourceinfo::relaysessioncreator::run () then Describe/setup/play pull the data through the rtspsourceinfo::runcreatesession (), After the RTSP process succeeds, the RTP data distribution address is configured, and the RTP data is pushed to the distribution list (that is, the destination list is the same level as the source list), which realizes the first pull backward mode described in the Darwin document. So how do we implement a server-wide pull mode (on Demand) forwarding based on client requests, which will be rolled out in subsequent documents.

So how to implement the forwarding of the push mode, this is also very simple, and there are ready-made code can be used, in Darwin's Qtssreflectormodule received from live555 Darwininjector through Annonce/setup (push mode)/play process, analog front-end device, push video stream to Darwin,darwin and then add each client request to reflectorsession output list in qtssreflectormodule for distribution. To achieve the first push back pull mode forwarding, then how to implement on the demand way of the first push pull, we will be introduced in the following article, and will be accompanied by some code, please look forward to.

--------------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.