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

Side by Side Diff: talk/media/base/rtpdataengine.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « talk/media/base/rtpdataengine.h ('k') | talk/media/base/rtpdataengine_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 void RtpDataMediaChannel::Construct(rtc::Timing* timing) { 89 void RtpDataMediaChannel::Construct(rtc::Timing* timing) {
90 sending_ = false; 90 sending_ = false;
91 receiving_ = false; 91 receiving_ = false;
92 timing_ = timing; 92 timing_ = timing;
93 send_limiter_.reset(new rtc::RateLimiter(kDataMaxBandwidth / 8, 1.0)); 93 send_limiter_.reset(new rtc::RateLimiter(kDataMaxBandwidth / 8, 1.0));
94 } 94 }
95 95
96 96
97 RtpDataMediaChannel::~RtpDataMediaChannel() { 97 RtpDataMediaChannel::~RtpDataMediaChannel() {
98 std::map<uint32, RtpClock*>::const_iterator iter; 98 std::map<uint32_t, RtpClock*>::const_iterator iter;
99 for (iter = rtp_clock_by_send_ssrc_.begin(); 99 for (iter = rtp_clock_by_send_ssrc_.begin();
100 iter != rtp_clock_by_send_ssrc_.end(); 100 iter != rtp_clock_by_send_ssrc_.end();
101 ++iter) { 101 ++iter) {
102 delete iter->second; 102 delete iter->second;
103 } 103 }
104 } 104 }
105 105
106 void RtpClock::Tick( 106 void RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) {
107 double now, int* seq_num, uint32* timestamp) {
108 *seq_num = ++last_seq_num_; 107 *seq_num = ++last_seq_num_;
109 *timestamp = timestamp_offset_ + static_cast<uint32>(now * clockrate_); 108 *timestamp = timestamp_offset_ + static_cast<uint32_t>(now * clockrate_);
110 } 109 }
111 110
112 const DataCodec* FindUnknownCodec(const std::vector<DataCodec>& codecs) { 111 const DataCodec* FindUnknownCodec(const std::vector<DataCodec>& codecs) {
113 DataCodec data_codec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName, 0); 112 DataCodec data_codec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName, 0);
114 std::vector<DataCodec>::const_iterator iter; 113 std::vector<DataCodec>::const_iterator iter;
115 for (iter = codecs.begin(); iter != codecs.end(); ++iter) { 114 for (iter = codecs.begin(); iter != codecs.end(); ++iter) {
116 if (!iter->Matches(data_codec)) { 115 if (!iter->Matches(data_codec)) {
117 return &(*iter); 116 return &(*iter);
118 } 117 }
119 } 118 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // And we should probably allow more than one per stream. 180 // And we should probably allow more than one per stream.
182 rtp_clock_by_send_ssrc_[stream.first_ssrc()] = new RtpClock( 181 rtp_clock_by_send_ssrc_[stream.first_ssrc()] = new RtpClock(
183 kDataCodecClockrate, 182 kDataCodecClockrate,
184 rtc::CreateRandomNonZeroId(), rtc::CreateRandomNonZeroId()); 183 rtc::CreateRandomNonZeroId(), rtc::CreateRandomNonZeroId());
185 184
186 LOG(LS_INFO) << "Added data send stream '" << stream.id 185 LOG(LS_INFO) << "Added data send stream '" << stream.id
187 << "' with ssrc=" << stream.first_ssrc(); 186 << "' with ssrc=" << stream.first_ssrc();
188 return true; 187 return true;
189 } 188 }
190 189
191 bool RtpDataMediaChannel::RemoveSendStream(uint32 ssrc) { 190 bool RtpDataMediaChannel::RemoveSendStream(uint32_t ssrc) {
192 if (!GetStreamBySsrc(send_streams_, ssrc)) { 191 if (!GetStreamBySsrc(send_streams_, ssrc)) {
193 return false; 192 return false;
194 } 193 }
195 194
196 RemoveStreamBySsrc(&send_streams_, ssrc); 195 RemoveStreamBySsrc(&send_streams_, ssrc);
197 delete rtp_clock_by_send_ssrc_[ssrc]; 196 delete rtp_clock_by_send_ssrc_[ssrc];
198 rtp_clock_by_send_ssrc_.erase(ssrc); 197 rtp_clock_by_send_ssrc_.erase(ssrc);
199 return true; 198 return true;
200 } 199 }
201 200
202 bool RtpDataMediaChannel::AddRecvStream(const StreamParams& stream) { 201 bool RtpDataMediaChannel::AddRecvStream(const StreamParams& stream) {
203 if (!stream.has_ssrcs()) { 202 if (!stream.has_ssrcs()) {
204 return false; 203 return false;
205 } 204 }
206 205
207 if (GetStreamBySsrc(recv_streams_, stream.first_ssrc())) { 206 if (GetStreamBySsrc(recv_streams_, stream.first_ssrc())) {
208 LOG(LS_WARNING) << "Not adding data recv stream '" << stream.id 207 LOG(LS_WARNING) << "Not adding data recv stream '" << stream.id
209 << "' with ssrc=" << stream.first_ssrc() 208 << "' with ssrc=" << stream.first_ssrc()
210 << " because stream already exists."; 209 << " because stream already exists.";
211 return false; 210 return false;
212 } 211 }
213 212
214 recv_streams_.push_back(stream); 213 recv_streams_.push_back(stream);
215 LOG(LS_INFO) << "Added data recv stream '" << stream.id 214 LOG(LS_INFO) << "Added data recv stream '" << stream.id
216 << "' with ssrc=" << stream.first_ssrc(); 215 << "' with ssrc=" << stream.first_ssrc();
217 return true; 216 return true;
218 } 217 }
219 218
220 bool RtpDataMediaChannel::RemoveRecvStream(uint32 ssrc) { 219 bool RtpDataMediaChannel::RemoveRecvStream(uint32_t ssrc) {
221 RemoveStreamBySsrc(&recv_streams_, ssrc); 220 RemoveStreamBySsrc(&recv_streams_, ssrc);
222 return true; 221 return true;
223 } 222 }
224 223
225 void RtpDataMediaChannel::OnPacketReceived( 224 void RtpDataMediaChannel::OnPacketReceived(
226 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { 225 rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
227 RtpHeader header; 226 RtpHeader header;
228 if (!GetRtpHeader(packet->data(), packet->size(), &header)) { 227 if (!GetRtpHeader(packet->data(), packet->size(), &header)) {
229 // Don't want to log for every corrupt packet. 228 // Don't want to log for every corrupt packet.
230 // LOG(LS_WARNING) << "Could not read rtp header from packet of length " 229 // LOG(LS_WARNING) << "Could not read rtp header from packet of length "
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 361
363 MediaChannel::SendPacket(&packet); 362 MediaChannel::SendPacket(&packet);
364 send_limiter_->Use(packet_len, now); 363 send_limiter_->Use(packet_len, now);
365 if (result) { 364 if (result) {
366 *result = SDR_SUCCESS; 365 *result = SDR_SUCCESS;
367 } 366 }
368 return true; 367 return true;
369 } 368 }
370 369
371 } // namespace cricket 370 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/base/rtpdataengine.h ('k') | talk/media/base/rtpdataengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698