Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc

Issue 2337453002: H.264 packetization mode 0 (try 2) (Closed)
Patch Set: Addressed hbos comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
index 27479458315de126fa3e551128a748b618a81714..6b9908b271a0502273c8aca7210a0789177555f3 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
@@ -11,6 +11,7 @@
#include "webrtc/modules/rtp_rtcp/source/rtp_format_h264.h"
#include <string.h>
+
#include <memory>
#include <utility>
#include <vector>
@@ -77,9 +78,16 @@ bool ParseStapAStartOffsets(const uint8_t* nalu_ptr,
} // namespace
-RtpPacketizerH264::RtpPacketizerH264(FrameType frame_type,
+RtpPacketizerH264::RtpPacketizerH264(const RTPVideoHeaderH264& parameters,
size_t max_payload_len)
- : max_payload_len_(max_payload_len) {}
+ : packetization_mode_(parameters.packetization_mode),
+ max_payload_len_(max_payload_len) {
+ if (packetization_mode_ == kH264PacketizationModeNotSet) {
+ LOG(LS_WARNING)
+ << "Creating H.264 RTP packetizer with default packetization mode";
+ packetization_mode_ = kH264PacketizationMode1;
+ }
+}
RtpPacketizerH264::~RtpPacketizerH264() {
}
@@ -163,6 +171,7 @@ void RtpPacketizerH264::SetPayloadData(
void RtpPacketizerH264::GeneratePackets() {
for (size_t i = 0; i < input_fragments_.size();) {
if (input_fragments_[i].length > max_payload_len_) {
+ RTC_CHECK_EQ(packetization_mode_, kH264PacketizationMode1);
PacketizeFuA(i);
++i;
} else {
@@ -249,9 +258,11 @@ bool RtpPacketizerH264::NextPacket(uint8_t* buffer,
input_fragments_.pop_front();
RTC_CHECK_LE(*bytes_to_send, max_payload_len_);
} else if (packet.aggregated) {
+ RTC_CHECK_EQ(packetization_mode_, kH264PacketizationMode1);
NextAggregatePacket(buffer, bytes_to_send);
RTC_CHECK_LE(*bytes_to_send, max_payload_len_);
} else {
+ RTC_CHECK_EQ(packetization_mode_, kH264PacketizationMode1);
NextFragmentPacket(buffer, bytes_to_send);
RTC_CHECK_LE(*bytes_to_send, max_payload_len_);
}

Powered by Google App Engine
This is Rietveld 408576698