Make ostream<< for enum class H264PacketizationMode
This makes it possible to use << and RTC_CHECK_EQ with this class. BUG=none Review-Url: https://codereview.webrtc.org/2554003002 Cr-Commit-Position: refs/heads/master@{#15456}
This commit is contained in:
parent
e36c46ede3
commit
ac382f3adc
@ -271,6 +271,22 @@ enum class H264PacketizationMode {
|
||||
SingleNalUnit // Mode 0 - only single NALU allowed
|
||||
};
|
||||
|
||||
// This function is declared inline because it is not clear which
|
||||
// .cc file it should belong to.
|
||||
// TODO(hta): Refactor. https://bugs.webrtc.org/6842
|
||||
inline std::ostream& operator<<(std::ostream& stream,
|
||||
H264PacketizationMode mode) {
|
||||
switch (mode) {
|
||||
case H264PacketizationMode::NonInterleaved:
|
||||
stream << "NonInterleaved";
|
||||
break;
|
||||
case H264PacketizationMode::SingleNalUnit:
|
||||
stream << "SingleNalUnit";
|
||||
break;
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
struct NaluInfo {
|
||||
uint8_t type;
|
||||
int sps_id;
|
||||
|
||||
@ -245,10 +245,7 @@ void RtpPacketizerH264::PacketizeSingleNalu(size_t fragment_index) {
|
||||
const Fragment* fragment = &input_fragments_[fragment_index];
|
||||
RTC_CHECK_GE(payload_size_left, fragment->length)
|
||||
<< "Payload size left " << payload_size_left << ", fragment length "
|
||||
<< fragment->length << ", packetization mode "
|
||||
<< (packetization_mode_ == H264PacketizationMode::SingleNalUnit
|
||||
? "SingleNalUnit"
|
||||
: "NonInterleaved");
|
||||
<< fragment->length << ", packetization mode " << packetization_mode_;
|
||||
RTC_CHECK_GT(fragment->length, 0u);
|
||||
packets_.push(PacketUnit(*fragment, true /* first */, true /* last */,
|
||||
false /* aggregated */, fragment->buffer[0]));
|
||||
@ -272,10 +269,10 @@ bool RtpPacketizerH264::NextPacket(RtpPacketToSend* rtp_packet,
|
||||
packets_.pop();
|
||||
input_fragments_.pop_front();
|
||||
} else if (packet.aggregated) {
|
||||
RTC_CHECK(packetization_mode_ == H264PacketizationMode::NonInterleaved);
|
||||
RTC_CHECK_EQ(H264PacketizationMode::NonInterleaved, packetization_mode_);
|
||||
NextAggregatePacket(rtp_packet);
|
||||
} else {
|
||||
RTC_CHECK(packetization_mode_ == H264PacketizationMode::NonInterleaved);
|
||||
RTC_CHECK_EQ(H264PacketizationMode::NonInterleaved, packetization_mode_);
|
||||
NextFragmentPacket(rtp_packet);
|
||||
}
|
||||
RTC_DCHECK_LE(rtp_packet->payload_size(), max_payload_len_);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user