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

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

Issue 2522553002: RtpPacketizer::NextPacket fills RtpPacket instead of payload. (Closed)
Patch Set: Named kTheMagicSix Created 4 years 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_video_generic.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.cc
index b47e9b9359eda00348168bb9f1c0e6e72de944cf..a2ce6646808baf69b4a9a885f30ec4509e084720 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.cc
@@ -13,6 +13,7 @@
#include "webrtc/base/logging.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
+#include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
namespace webrtc {
@@ -45,32 +46,33 @@ void RtpPacketizerGeneric::SetPayloadData(
generic_header_ = RtpFormatVideoGeneric::kFirstPacketBit;
}
-bool RtpPacketizerGeneric::NextPacket(uint8_t* buffer,
- size_t* bytes_to_send,
+bool RtpPacketizerGeneric::NextPacket(RtpPacketToSend* packet,
bool* last_packet) {
+ RTC_DCHECK(packet);
+ RTC_DCHECK(last_packet);
if (payload_size_ < payload_length_) {
payload_length_ = payload_size_;
}
payload_size_ -= payload_length_;
- *bytes_to_send = payload_length_ + kGenericHeaderLength;
- assert(payload_length_ <= max_payload_len_);
+ RTC_DCHECK_LE(payload_length_, max_payload_len_);
- uint8_t* out_ptr = buffer;
+ uint8_t* out_ptr =
+ packet->AllocatePayload(kGenericHeaderLength + payload_length_);
// Put generic header in packet
if (frame_type_ == kVideoFrameKey) {
generic_header_ |= RtpFormatVideoGeneric::kKeyFrameBit;
}
- *out_ptr++ = generic_header_;
+ out_ptr[0] = generic_header_;
// Remove first-packet bit, following packets are intermediate
generic_header_ &= ~RtpFormatVideoGeneric::kFirstPacketBit;
// Put payload in packet
- memcpy(out_ptr, payload_data_, payload_length_);
+ memcpy(out_ptr + kGenericHeaderLength, payload_data_, payload_length_);
payload_data_ += payload_length_;
*last_packet = payload_size_ <= 0;
-
+ packet->SetMarker(*last_packet);
return true;
}
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698