diff --git a/webrtc/modules/include/module_common_types.h b/webrtc/modules/include/module_common_types.h index 3df93b6c89..fa0826a551 100644 --- a/webrtc/modules/include/module_common_types.h +++ b/webrtc/modules/include/module_common_types.h @@ -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; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc index 9d71803f3b..e896c65f97 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc @@ -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_);