зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305813 - do not send empty StreamId;r=drno
Also moving RID (StreamID) storage to the stack to clear up the TODO item and simplify the code. When unset the StreamID is stored as an empty string. Added missing GUARDED_BY on rid_ Added a check to shortcut checking strlen on the StreamId when it is an empty string (which is most of the time). MozReview-Commit-ID: EPUlPNBXYsQ --HG-- extra : rebase_source : 08e1b9ea796c991d141164424014d2311ff9341c
This commit is contained in:
Родитель
3d1a5848a6
Коммит
5579381f1c
|
@ -97,7 +97,7 @@ RTPSender::RTPSender(
|
|||
payload_type_(-1),
|
||||
payload_type_map_(),
|
||||
rtp_header_extension_map_(),
|
||||
rid_(NULL),
|
||||
rid_{0},
|
||||
packet_history_(clock),
|
||||
flexfec_packet_history_(clock),
|
||||
// Statistics
|
||||
|
@ -166,10 +166,6 @@ RTPSender::~RTPSender() {
|
|||
delete it->second;
|
||||
payload_type_map_.erase(it);
|
||||
}
|
||||
|
||||
if (rid_) {
|
||||
delete[] rid_;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t RTPSender::ActualSendBitrateKbit() const {
|
||||
|
@ -200,13 +196,12 @@ uint32_t RTPSender::NackOverheadRate() const {
|
|||
|
||||
int32_t RTPSender::SetRID(const char* rid) {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
// TODO(jesup) avoid allocations
|
||||
if (!rid_ || strlen(rid_) < strlen(rid)) {
|
||||
// rid rarely changes length....
|
||||
delete [] rid_;
|
||||
rid_ = new char[strlen(rid)+1];
|
||||
const size_t len = rid ? strlen(rid) : 0;
|
||||
if (!len || len >= sizeof(rid_)) {
|
||||
rid_[0] = '\0';
|
||||
} else {
|
||||
memmove(&rid_[0], rid, len + 1);
|
||||
}
|
||||
strcpy(rid_, rid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -455,7 +450,7 @@ bool RTPSender::SendOutgoingData(FrameType frame_type,
|
|||
result = video_->SendVideo(video_type, frame_type, payload_type,
|
||||
rtp_timestamp, capture_time_ms, payload_data,
|
||||
payload_size, fragmentation, rtp_header,
|
||||
rid_);
|
||||
&rid_[0]);
|
||||
}
|
||||
|
||||
rtc::CritScope cs(&statistics_crit_);
|
||||
|
|
|
@ -280,7 +280,7 @@ class RTPSender {
|
|||
|
||||
RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_);
|
||||
|
||||
char* rid_;
|
||||
char rid_[kRIDSize + 1] GUARDED_BY(send_critsect_);
|
||||
|
||||
// Tracks the current request for playout delay limits from application
|
||||
// and decides whether the current RTP frame should include the playout
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
|
@ -324,8 +325,11 @@ bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type,
|
|||
rtp_header->SetExtension<VideoOrientation>(current_rotation);
|
||||
last_rotation_ = current_rotation;
|
||||
}
|
||||
if (rid) {
|
||||
rtp_header->SetExtensionWithLength<StreamId>(strlen(rid)-1, rid);
|
||||
if (rid && rid[0]) {
|
||||
const size_t len = strlen(rid);
|
||||
if (len) {
|
||||
rtp_header->SetExtensionWithLength<StreamId>(len - 1, rid);
|
||||
}
|
||||
}
|
||||
|
||||
// FEC settings.
|
||||
|
|
Загрузка…
Ссылка в новой задаче