RTMP.ControlMessages (rtmp v0.1.0)

Copy Markdown View Source

Protocol control messages (message types 1–6) and User Control events.

parse/2 decodes an incoming control message payload; the builder functions return {type_id, payload} for outgoing ones, which are sent on chunk stream 2, message stream 0.

Set Chunk Size (1) and Abort (2) affect chunk framing and are applied by RTMP.ChunkStream itself as soon as they arrive; parse/2 still understands them for completeness.

User Control events

EventIdPayload
Stream Begin0stream id
Stream EOF1stream id
Stream Dry2stream id
Set Buffer Length3stream id, buffer ms
Stream Is Recorded4stream id
Ping Request6timestamp
Ping Response7timestamp

Summary

Types

limit_type()

@type limit_type() :: :hard | :soft | :dynamic

t()

@type t() ::
  {:set_chunk_size, pos_integer()}
  | {:abort, non_neg_integer()}
  | {:acknowledgement, non_neg_integer()}
  | {:user_control, user_control_event()}
  | {:window_ack_size, non_neg_integer()}
  | {:set_peer_bandwidth, non_neg_integer(), limit_type()}

user_control_event()

@type user_control_event() ::
  {:stream_begin, non_neg_integer()}
  | {:stream_eof, non_neg_integer()}
  | {:stream_dry, non_neg_integer()}
  | {:set_buffer_length, non_neg_integer(), non_neg_integer()}
  | {:stream_is_recorded, non_neg_integer()}
  | {:ping_request, non_neg_integer()}
  | {:ping_response, non_neg_integer()}
  | {:unknown, non_neg_integer(), binary()}

Functions

acknowledgement(sequence)

@spec acknowledgement(non_neg_integer()) :: {byte(), binary()}

is_control(type_id)

(macro)

True for message type ids 1–6.

parse(type_id, arg2)

@spec parse(byte(), binary()) :: {:ok, t()} | {:error, term()}

Decodes a protocol control message payload.

ping_request(timestamp)

@spec ping_request(non_neg_integer()) :: {byte(), binary()}

ping_response(timestamp)

@spec ping_response(non_neg_integer()) :: {byte(), binary()}

set_chunk_size(size)

@spec set_chunk_size(pos_integer()) :: {byte(), binary()}

set_peer_bandwidth(size, limit_type \\ :dynamic)

@spec set_peer_bandwidth(non_neg_integer(), limit_type()) :: {byte(), binary()}

stream_begin(stream_id)

@spec stream_begin(non_neg_integer()) :: {byte(), binary()}

stream_eof(stream_id)

@spec stream_eof(non_neg_integer()) :: {byte(), binary()}

window_ack_size(size)

@spec window_ack_size(non_neg_integer()) :: {byte(), binary()}