Expand description
§The RTMP Messages
After handshake, both are required to negotiate what are needed for sending/receiving. Currently, following messages are used in negotiation:
- User Control
Window Acknowledgement Size
- Command
Every message has headers.
See sheave_core::messages::headers
about them.
§User Control
User Control messages are additional informations for starting streaming. These consist of following format:
Field | Length (in bytes) | Description |
---|---|---|
Event Type | 2 | A marker which indicates a kind of data sent. |
Event Data | Various | Actual data of this message. |
§Events
Currently, following events are used:
§Command
Command messages are contained basic informations actually required to negotiate.
These encodes/decodes into/from [the Action Message Format 0
].
These consist of following format:
Field | AMF Type | Description |
---|---|---|
Command Name | String | The command which is currently negotiated. |
Transaction ID | Number | A number which indicates a step of this negotiation. |
Setting Data | Various | Actually negotiated data. |
Furthermore commands have following patterns:
- NetConnection
- NetStream
§NetConnection
NetConnection commands are defined as following messages:
connect
releaseStream
FCPublish
createStream
FCSubscribe
getStreamLength
(in FFmpeg) /set_playlist
(in OBS) (note these mayn’t be sent.)
§NetStream
NetStream commands are defined as following messages:
§Any data
After negotiation, the server receives actual audio/video data from clients.
However also FLV metadata is received as the AMF (v0).
The message what contains FLV metadata is called @setDataFrame
.
This consists of following format:
Field | AMF Type | Description |
---|---|---|
Command Name (probably) | String | "@setDataFrame" |
Setting Data | Various | In this case, see ScriptDataTag . |
Modules§
Structs§
- Acknowledgement
- The message to tell that some message length has exceeded the server-side bandwidth range. Note this must be input the total message length in receiving. (it’s not bytes received.)
- Audio
- Chunk
Size - Tells a size to chunk its stream to the partner.
- Command
Error - The response message that some command failed.
- Connect
- The command to exchange an information about application using.
- Connect
Result - The response message for Connect requests.
- Create
Stream - The command to request emitting a message ID to a server.
- Create
Stream Result - The response message for CreateStream requests.
- Delete
Stream - The command to request to delete its message ID.
- FcPublish
- The command to tell a path to the server.
- FcSubscribe
- The command to tell the topic path.
- FcUnpublish
- This command is same as
FcPublish
except this requests to delete the topic path. - GetStream
Length - The command to tell the topic path. (e.g. something file name)
- GetStream
Length Result - The response message for GetStreamLength requests.
- Inconsistent
Command - An error that some command name differs you expect.
- Inconsistent
Event Type - An error that some event type differs you expect.
- Invalid
Publishing Type - An error that some publishing type differs you expect.
- Negative
Chunk Size - An error that some chunk size is negative.
- OnFc
Publish - The response message for FcPublish requests.
- OnStatus
- The response message for Publish requests.
- Peer
Bandwidth - The message to tell the client-side bandwidth. This has 2 ways of comparision by which field you specifies.
- Play
- The command to tell playing information.
- Playlist
Ready - The response message for SetPlaylist requests.
- Publish
- The command to tell publishing information.
- Publishing
Failure - An error that publishing has failed by something cause.
- Release
Stream - The command to tell some path to the server.
- Release
Stream Result - The response message for ReleaseStream requests.
- SetBuffer
Length - The event to tell that its stream will be buffered, to the server.
- SetData
Frame - The message to handle something data.
- SetPlaylist
- The command to tell the Playlist of streams.
- Stream
Begin - The event to tell that the stream is ready to a client.
- Video
- Window
Acknowledgement Size - The message to tell the bandwidth limit as a receiver side.
Enums§
- Channel
- The IDs which are assigned every roles of chunks.
This is mainly used for the
BasicHeader
’s chunk ID. - Event
Type - The IDs which are types of user control messages.
- Limit
Type - Representation of the limit type field in the PeerBandwidth message.
- Play
Mode - Representation of the way to subscribe its stream.
Traits§
- Chunk
Data - Uniforms chunk data by a channel numbers and a message type.
- Command
- User
Control - Uniforms user control messages by an event type.
Functions§
- inconsistent_
command - A utility function of constructing an
InconsistentCommand
error. - inconsistent_
event_ type - A utility function of constructing an
InconsistentEventType
error. - invalid_
publishing_ type - A utility function of constructing an
InvalidPublishingType
error. - negative_
chunk_ size - A utility function of constructing a
NegativeChunkSize
error. - publishing_
failure - A utility function of constructing a
PublishingFailure
error.