VP8 RTP packetizer rewrite
Rewriting the RTP packetizer for VP8 to accommodate more functionality. This CL does not change the formatting other than that the kStrict mode now produces equal-sized fragments. Review URL: http://webrtc-codereview.appspot.com/33006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@80 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -33,9 +33,10 @@ namespace webrtc
|
||||
|
||||
enum VP8PacketizerMode
|
||||
{
|
||||
kStrict = 0, // split partitions if too large; never aggregate partitions
|
||||
kAggregate, // split partitions if too large; aggregate whole partitions
|
||||
kSloppy, // split entire payload without considering partition boundaries
|
||||
kStrict = 0, // split partitions if too large; never aggregate, balance size
|
||||
kAggregate, // split partitions if too large; aggregate whole partitions
|
||||
kSloppy, // split entire payload without considering partition limits
|
||||
kNumModes,
|
||||
};
|
||||
|
||||
// Packetizer for VP8.
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
// The payload_data must be exactly one encoded VP8 frame.
|
||||
RtpFormatVp8(const WebRtc_UWord8* payload_data,
|
||||
WebRtc_UWord32 payload_size,
|
||||
const RTPFragmentationHeader* fragmentation,
|
||||
const RTPFragmentationHeader& fragmentation,
|
||||
VP8PacketizerMode mode);
|
||||
|
||||
// Initialize without fragmentation info. Mode kSloppy will be used.
|
||||
@@ -65,8 +66,20 @@ public:
|
||||
int* bytes_to_send, bool* last_packet);
|
||||
|
||||
private:
|
||||
// Determine from which fragment the next byte to send will be taken.
|
||||
int GetFragIdx();
|
||||
enum AggregationMode
|
||||
{
|
||||
kAggrNone = 0, // no aggregation
|
||||
kAggrPartitions, // aggregate intact partitions
|
||||
kAggrFragments // aggregate intact and fragmented partitions
|
||||
};
|
||||
|
||||
static const AggregationMode aggr_modes_[kNumModes];
|
||||
static const bool bal_modes_[kNumModes];
|
||||
static const bool sep_first_modes_[kNumModes];
|
||||
|
||||
// Calculate size of next chunk to send. Returns 0 if none can be sent.
|
||||
int CalcNextSize(int max_payload_len, int remaining_bytes,
|
||||
bool split_payload) const;
|
||||
|
||||
// Write the payload header and copy the payload to the buffer.
|
||||
// Will copy send_bytes bytes from the current position on the payload data.
|
||||
@@ -77,12 +90,15 @@ private:
|
||||
|
||||
const WebRtc_UWord8* payload_data_;
|
||||
const WebRtc_UWord32 payload_size_;
|
||||
RTPFragmentationHeader frag_info_;
|
||||
RTPFragmentationHeader part_info_;
|
||||
int payload_bytes_sent_;
|
||||
VP8PacketizerMode mode_;
|
||||
int part_ix_;
|
||||
bool beginning_; // first partition in this frame
|
||||
bool first_fragment_; // first fragment of a partition
|
||||
const int vp8_header_bytes_; // length of VP8 payload header
|
||||
AggregationMode aggr_mode_;
|
||||
bool balance_;
|
||||
bool separate_first_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user