Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information. This CL was reviewed and approved in pieces in the following CLs: https://webrtc-codereview.appspot.com/24209004/ https://webrtc-codereview.appspot.com/24229004/ https://webrtc-codereview.appspot.com/24259004/ https://webrtc-codereview.appspot.com/25109004/ https://webrtc-codereview.appspot.com/26099004/ https://webrtc-codereview.appspot.com/27069004/ https://webrtc-codereview.appspot.com/27969004/ https://webrtc-codereview.appspot.com/27989004/ https://webrtc-codereview.appspot.com/29009004/ https://webrtc-codereview.appspot.com/30929004/ https://webrtc-codereview.appspot.com/30939004/ https://webrtc-codereview.appspot.com/31999004/ Committing as TBR to the original reviewers. BUG=chromium:81439 TEST=none TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom Review URL: https://webrtc-codereview.appspot.com/23129004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -113,10 +113,9 @@ void AcmReceiveTest::Run() {
|
||||
header.header = packet->header();
|
||||
header.frameType = kAudioFrameSpeech;
|
||||
memset(&header.type.Audio, 0, sizeof(RTPAudioHeader));
|
||||
EXPECT_TRUE(
|
||||
acm_->InsertPacket(packet->payload(),
|
||||
static_cast<int32_t>(packet->payload_length_bytes()),
|
||||
header))
|
||||
EXPECT_TRUE(acm_->InsertPacket(packet->payload(),
|
||||
packet->payload_length_bytes(),
|
||||
header))
|
||||
<< "Failure when inserting packet:" << std::endl
|
||||
<< " PT = " << static_cast<int>(header.header.payloadType) << std::endl
|
||||
<< " TS = " << header.header.timestamp << std::endl
|
||||
|
||||
@ -261,7 +261,7 @@ AudioPlayoutMode AcmReceiver::PlayoutMode() const {
|
||||
|
||||
int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||
const uint8_t* incoming_payload,
|
||||
int length_payload) {
|
||||
size_t length_payload) {
|
||||
uint32_t receive_timestamp = 0;
|
||||
InitialDelayManager::PacketType packet_type =
|
||||
InitialDelayManager::kUndefinedPacket;
|
||||
|
||||
@ -67,7 +67,7 @@ class AcmReceiver {
|
||||
//
|
||||
int InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||
const uint8_t* incoming_payload,
|
||||
int length_payload);
|
||||
size_t length_payload);
|
||||
|
||||
//
|
||||
// Asks NetEq for 10 milliseconds of decoded audio.
|
||||
|
||||
@ -115,12 +115,12 @@ class AcmReceiverTest : public AudioPacketizationCallback,
|
||||
}
|
||||
}
|
||||
|
||||
virtual int SendData(
|
||||
virtual int32_t SendData(
|
||||
FrameType frame_type,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) OVERRIDE {
|
||||
if (frame_type == kFrameEmpty)
|
||||
return 0;
|
||||
|
||||
@ -124,7 +124,7 @@ class AcmReceiverTestOldApi : public AudioPacketizationCallback,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) OVERRIDE {
|
||||
if (frame_type == kFrameEmpty)
|
||||
return 0;
|
||||
|
||||
@ -94,7 +94,7 @@ int32_t AcmSendTest::SendData(FrameType frame_type,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
// Store the packet locally.
|
||||
frame_type_ = frame_type;
|
||||
|
||||
@ -49,7 +49,7 @@ class AcmSendTest : public AudioPacketizationCallback, public PacketSource {
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
@ -98,7 +98,7 @@ int32_t AcmSendTestOldApi::SendData(
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
// Store the packet locally.
|
||||
frame_type_ = frame_type;
|
||||
|
||||
@ -51,7 +51,7 @@ class AcmSendTestOldApi : public AudioPacketizationCallback,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
@ -314,7 +314,7 @@ int AudioCodingModuleImpl::EncodeFragmentation(int fragmentation_index,
|
||||
int AudioCodingModuleImpl::ProcessDualStream() {
|
||||
uint8_t stream[kMaxNumFragmentationVectors * MAX_PAYLOAD_SIZE_BYTE];
|
||||
uint32_t current_timestamp;
|
||||
int16_t length_bytes = 0;
|
||||
size_t length_bytes = 0;
|
||||
RTPFragmentationHeader my_fragmentation;
|
||||
|
||||
uint8_t my_red_payload_type;
|
||||
@ -336,8 +336,7 @@ int AudioCodingModuleImpl::ProcessDualStream() {
|
||||
// Nothing to send.
|
||||
return 0;
|
||||
}
|
||||
int len_bytes_previous_secondary = static_cast<int>(
|
||||
fragmentation_.fragmentationLength[2]);
|
||||
size_t len_bytes_previous_secondary = fragmentation_.fragmentationLength[2];
|
||||
assert(len_bytes_previous_secondary <= MAX_PAYLOAD_SIZE_BYTE);
|
||||
bool has_previous_payload = len_bytes_previous_secondary > 0;
|
||||
|
||||
@ -1689,13 +1688,8 @@ int AudioCodingModuleImpl::ReceiveCodec(CodecInst* current_codec) const {
|
||||
|
||||
// Incoming packet from network parsed and ready for decode.
|
||||
int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload,
|
||||
const int payload_length,
|
||||
const size_t payload_length,
|
||||
const WebRtcRTPHeader& rtp_header) {
|
||||
if (payload_length < 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
|
||||
"IncomingPacket() Error, payload-length cannot be negative");
|
||||
return -1;
|
||||
}
|
||||
int last_audio_pltype = receiver_.last_audio_payload_type();
|
||||
if (receiver_.InsertPacket(rtp_header, incoming_payload, payload_length) <
|
||||
0) {
|
||||
@ -1797,16 +1791,9 @@ int AudioCodingModuleImpl::RegisterVADCallback(ACMVADCallback* vad_callback) {
|
||||
|
||||
// TODO(tlegrand): Modify this function to work for stereo, and add tests.
|
||||
int AudioCodingModuleImpl::IncomingPayload(const uint8_t* incoming_payload,
|
||||
int payload_length,
|
||||
size_t payload_length,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp) {
|
||||
if (payload_length < 0) {
|
||||
// Log error in trace file.
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
|
||||
"IncomingPacket() Error, payload-length cannot be negative");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// We are not acquiring any lock when interacting with |aux_rtp_header_| no
|
||||
// other method uses this member variable.
|
||||
if (aux_rtp_header_ == NULL) {
|
||||
@ -1960,7 +1947,7 @@ int AudioCodingModuleImpl::REDPayloadISAC(int isac_rate,
|
||||
}
|
||||
|
||||
void AudioCodingModuleImpl::ResetFragmentation(int vector_size) {
|
||||
for (int n = 0; n < kMaxNumFragmentationVectors; n++) {
|
||||
for (size_t n = 0; n < kMaxNumFragmentationVectors; n++) {
|
||||
fragmentation_.fragmentationOffset[n] = n * MAX_PAYLOAD_SIZE_BYTE;
|
||||
}
|
||||
memset(fragmentation_.fragmentationLength, 0, kMaxNumFragmentationVectors *
|
||||
@ -2116,14 +2103,14 @@ bool AudioCodingImpl::RegisterReceiveCodec(int decoder_type,
|
||||
}
|
||||
|
||||
bool AudioCodingImpl::InsertPacket(const uint8_t* incoming_payload,
|
||||
int32_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const WebRtcRTPHeader& rtp_info) {
|
||||
return acm_old_->IncomingPacket(
|
||||
incoming_payload, payload_len_bytes, rtp_info) == 0;
|
||||
}
|
||||
|
||||
bool AudioCodingImpl::InsertPayload(const uint8_t* incoming_payload,
|
||||
int32_t payload_len_byte,
|
||||
size_t payload_len_byte,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp) {
|
||||
FATAL() << "Not implemented yet.";
|
||||
|
||||
@ -156,13 +156,13 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
||||
|
||||
// Incoming packet from network parsed and ready for decode.
|
||||
virtual int IncomingPacket(const uint8_t* incoming_payload,
|
||||
int payload_length,
|
||||
const size_t payload_length,
|
||||
const WebRtcRTPHeader& rtp_info) OVERRIDE;
|
||||
|
||||
// Incoming payloads, without rtp-info, the rtp-info will be created in ACM.
|
||||
// One usage for this API is when pre-encoded files are pushed in ACM.
|
||||
virtual int IncomingPayload(const uint8_t* incoming_payload,
|
||||
int payload_length,
|
||||
const size_t payload_length,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp) OVERRIDE;
|
||||
|
||||
@ -423,11 +423,11 @@ class AudioCodingImpl : public AudioCoding {
|
||||
uint8_t payload_type) OVERRIDE;
|
||||
|
||||
virtual bool InsertPacket(const uint8_t* incoming_payload,
|
||||
int32_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const WebRtcRTPHeader& rtp_info) OVERRIDE;
|
||||
|
||||
virtual bool InsertPayload(const uint8_t* incoming_payload,
|
||||
int32_t payload_len_byte,
|
||||
size_t payload_len_byte,
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp) OVERRIDE;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ const int kSampleRateHz = 16000;
|
||||
const int kNumSamples10ms = kSampleRateHz / 100;
|
||||
const int kFrameSizeMs = 10; // Multiple of 10.
|
||||
const int kFrameSizeSamples = kFrameSizeMs / 10 * kNumSamples10ms;
|
||||
const int kPayloadSizeBytes = kFrameSizeSamples * sizeof(int16_t);
|
||||
const size_t kPayloadSizeBytes = kFrameSizeSamples * sizeof(int16_t);
|
||||
const uint8_t kPayloadType = 111;
|
||||
|
||||
class RtpUtility {
|
||||
@ -87,7 +87,7 @@ class PacketizationCallbackStub : public AudioPacketizationCallback {
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) OVERRIDE {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
++num_calls_;
|
||||
|
||||
@ -87,7 +87,7 @@ class PacketizationCallbackStub : public AudioPacketizationCallback {
|
||||
uint8_t payload_type,
|
||||
uint32_t timestamp,
|
||||
const uint8_t* payload_data,
|
||||
uint16_t payload_len_bytes,
|
||||
size_t payload_len_bytes,
|
||||
const RTPFragmentationHeader* fragmentation) OVERRIDE {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
++num_calls_;
|
||||
|
||||
Reference in New Issue
Block a user