NAME
Net::RTP::Packet - RTP Packet object (RFC3550)
SYNOPSIS
use Net::RTP::Packet;
my $packet = new Net::RTP::Packet();
$packet->payload_type( 10 );
$packet->seq_num( 6789 );
$packet->timestamp( 76303 );
$packet->payload( $audio );
$binary = $packet->encode();
DESCRIPTION
Net::RTP::Packet implements RTP packet header encoding and decoding.
- $packet = new Net::RTP::Packet( [$binary] )
-
The new() method is the constructor for the
Net::RTP::Packet
class. The RTP version number is initialized to 2. The sequence number, timestamp and SSRC are all randomized.The
$binary
parameter is optional, and is passed todecode()
if present. - $packet->version( [$value] )
-
Get or set the version number of the RTP packet. Only version 2 is currently supported.
- $packet->padding( [$value] )
-
Get or set the number of bytes of padding at the end of the RTP packet.
- $packet->extension()
-
Returns true if there was an RTP header extension present in the packet. It isn't currently possible to get the data of that extension.
- $packet->marker( [$value] )
-
Get or set the value of the marker flag in the header. If true, it usually means that this RTP packet is the start of a frame boundary.
- $packet->payload_type( [$value] )
-
Get or set the payload type of the packet. See
http://www.iana.org/assignments/rtp-parameters
for the Payload Type values. - $packet->seq_num( [$value] )
-
Get or set the sequence number of the packet. The sequence number increments by one for each RTP data packet sent, and may be used by the receiver to detect packet loss and to restore packet sequence.
- $packet->seq_num_increment( [$amount] )
-
Increment the packet's sequence number by
$amount
. If no amount is specified, then the sequence number is incremented by 1. Returns the packet's new sequence number if successful. - $packet->timestamp( [$value] )
-
Get or set the timestamp of the packet. The timestamp reflects the sampling instant of the first octet in the RTP data packet.
- $packet->timestamp_increment( [$amount] )
-
Increment the packet's timestamp by
$amount
. If no amount is specified, then the timestamp is incremented by 1. Returns the packet's new timestamp if successful. - $packet->ssrc( [$value] )
-
Get or set the 32-bit source identifier of the packet.
- $packet->csrc( [$value] )
-
Get or set an ARRAYREF of contributing source identifiers for the packet.
- $packet->payload( [$value] )
-
Get or set the payload data for the packet.
- $packet->payload_size()
-
Return the length (in bytes) of the packet's payload.
- $packet->source_ip()
-
Return the source IP address of the packet (as an ASCII string). If the source IP is not known, the value is undefined.
- $packet->source_port()
-
Return the source port of the packet (as an ASCII string). If the source port is not known, the value is undefined.
- $packet->size()
-
Return the length (in bytes) of the binary RTP packet.
Note: The size of the packet is only calculated during encode() and decode().
- $packet->decode( $binary )
-
Decodes binary RTP packet header into the packet object.
- $data = $packet->endcode()
-
Encode a packet object into a binary RTP packet.
SEE ALSO
http://www.ietf.org/rfc/rfc3550.txt
BUGS
Please report any bugs or feature requests to bug-net-rtp@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
AUTHOR
Nicholas J Humfrey, njh@cpan.org
COPYRIGHT AND LICENSE
Copyright (C) 2006 University of Southampton
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 415:
You forgot a '=back' before '=head1'