Symbian development diary-streaming media and Network Transmission

Source: Internet
Author: User

2008.7.17

The program cannot connect to the server through cmnet on the mobile phone, but the mobile phone can connect to the server (such as HTTP and RealPlayer ). You can also connect to the Internet IP address of the server in the simulator. You have to study rtspclient and socket in the morning.

2008.7.18

Test with rsocket example. If the problem is the same, the connection cmnet prompts "conn. Failed-46". The permission is insufficient. Originally, the socket required the networkservices capability. Modify MMP, reallyclean, and bldmake clean, and build and connect successfully.

Lessons learned from the twists and turns of the past few days: 1. You must master the log debugging method to locate errors as quickly as possible.

2. Be familiar with the meaning of the error code

3. Read s60 SDK help

4. Study s60ex routines

 

RTSP notes

RTSP (Real Time Streaming Protocol) is a protocol for establishing and controlling multimedia data transmission. It is based on TCP, and on RTP, RTP is based on UDP.

Simple RTSP interaction process:

C Indicates the RTSP client, and s indicates the RTSP server.

1. C-> S: Option request // ask s which methods are available

1. S-> C: Option response // s the response information includes all available methods provided

2. C-> S: DESCRIBE request // obtain the media initialization description provided by S.

2. S-> C: Describe response // s response media initialization description, mainly SDP

3. C-> S: SETUP Request // sets the session attributes and transmission mode to remind s to establish a session

3. S-> C: setup response // s creates a session and returns the session identifier and session-related information.

4. C-> S: Play request // C request playback

4. S-> C: Play response // S: the requested information is returned.

S-> C: Send streaming media data

5. C-> S: teardown request // C request to close the session

5. S-> C: teardown response // s should request

The above process is a standard and friendly RTSP process, but the actual needs are not necessarily step by step.

Steps 3rd and 4 are required! Step 1: The option request is optional as long as the server client has agreed on which methods are available. Step 2: If we have other ways to obtain media initialization descriptions (such as HTTP requests), we do not need to use the DESCRIBE request in RTSP. Step 5: determine whether or not to use the system based on the system requirements.

Common RTSP methods:

1. Option

The purpose is to obtain available methods provided by the server:

Options rtsp: // 192.168.20.136: 5000/xxx666 RTSP/1.0

CSeq: 1 // each message is marked with a serial number. The first packet is usually an option request message.

User-Agent: VLC Media Player (live555 streaming media v2005.11.10)

Server Response Information includes the following methods:

RTSP/1.0 200 OK

Server: userver 0.9.7 _ RC1

CSeq: 1 // The CSeq value of each Response Message corresponds to the CSeq of the Request Message

Public: Options, describe, setup, teardown, play, pause, scale, get_parameter // available methods provided by the server

2. Describe

C initiates a DESCRIBE request to S to obtain the Session Description (SDP ):

Describe rtsp: // 192.168.20.136: 5000/xxx666 RTSP/1.0

CSeq: 2

Token:

Accept: Application/SDP

User-Agent: VLC Media Player (live555 streaming media v2005.11.10)

The server responds to some descriptions of this session (SDP ):

RTSP/1.0 200 OK

Server: userver 0.9.7 _ RC1

CSeq: 2

X-Prev-URL: rtsp: // 192.168.20.136: 5000

X-next-URL: rtsp: // 192.168.20.136: 5000

X-Accept-retransmit: Our-retransmit

X-Accept-dynamic-rate: 1

Cache-control: Must-revalidate

Last-modified: Fri, 10 Nov 2006 12:34:38 GMT

Date: Fri, 10 Nov 2006 12:34:38 GMT

Expires: Fri, 10 Nov 2006 12:34:38 GMT

Content-base: rtsp: // 192.168.20.136: 5000/xxx666/

Content-Length: 344

Content-Type: Application/SDP

V = 0 // The following information is SDP

O = onewaveuserverng 1451516402 1025358037 in ip4 192.168.20.136

S =/xxx666

U = http :///

E = admin @

C = in ip4 0.0.0.0

T = 0 0

A = Isma-compliance: 1, 1.0, 1

A = range: Treaty = 0-

M = video 0 RTP/AVP 96 // M indicates the media description. The following is the media description of the video channel in the session.

A = rtpmap: 96 MP4V-ES/90000

A = fmtp: 96 profile-level-id = 245;

A = control: trackID = 0 // trackID = 0 indicates that the video stream uses channel 0.

3. Setup

The client reminds the server to establish a session and determine the transmission mode:

Setup rtsp: // 192.168.20.136: 5000/xxx666/trackID = 0 RTSP/1.0

CSeq: 3

Transport: RTP/AVP/tcp; unicast; interleaved = 0-1

User-Agent: VLC Media Player (live555 streaming media v2005.11.10)

// The URI contains trackID = 0, indicating that the channel is set. The transport parameter sets the transmission mode and package structure. The second byte location of the next packet header is interleaved. Its value is different for each channel. The interleaved value of trackID = 0 has two 0 or values, indicating the RTP packet, 1 indicates the RTCP package. The receiver distinguishes the packet based on the value of interleaved.

Server Response Information:

RTSP/1.0 200 OK

Server: userver 0.9.7 _ RC1

CSeq: 3

Session: 6310936469860791894 // The session identifier that the server responds

Cache-control: No-Cache

Transport: RTP/AVP/tcp; unicast; interleaved = 0-1; SSRC = 6b8b4567

4. Play

The client sends a playback request:

Play rtsp: // 192.168.20.136: 5000/xxx666 RTSP/1.0

CSeq: 4

Session: 6310936469860791894

Range: NLE = 0.000-// set the playing time range

User-Agent: VLC Media Player (live555 streaming media v2005.11.10)

Server Response Information:

RTSP/1.0 200 OK

Server: userver 0.9.7 _ RC1

CSeq: 4

Session: 6310936469860791894

Range: Treaty = 0.000000-

RTP-Info: url = trackID = 0; seq = 17040; rtptime = 1467265309

// Seq and rtptime are both information in the RTP package.

5. teardown

The client initiates a close request:

Teardown rtsp: // 192.168.20.136: 5000/xxx666 RTSP/1.0

CSeq: 5

Session: 6310936469860791894

User-Agent: VLC Media Player (live555 streaming media v2005.11.10)

Server Response:

RTSP/1.0 200 OK

Server: userver 0.9.7 _ RC1

CSeq: 5

Session: 6310936469860791894

Connection: Close

The above methods are the most commonly used in the interaction process. Other important methods include get/set_parameter, pause, redirect, and so on.

PS:

SDP format

V = <version>

O = <username> <session ID> <version> <network type> <address>

S = <session Name>

I = <Session Description>

U = <URI>

E = <email address>
P = <phone number>
C = <network type> <address type> <connection address>

B = <modifier >:< bandwidth-value>

T = <start time> <stop time>

R = <repeat interval> <active duration> <list of offsets from start-time>

Z = <adjustment time> <OFFSET> ....

K = <method>
K = <method >:< encryption key>

A = <attribute>
A = <attribute >:< value>

M = <media> <port> <transport> <FMT list>

 

Related Article

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.