OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 0x00, 0x00, 0x00, 0x00 | 29 0x00, 0x00, 0x00, 0x00 |
30 }; | 30 }; |
31 | 31 |
32 // Amount of overhead SRTP may take. We need to leave room in the | 32 // Amount of overhead SRTP may take. We need to leave room in the |
33 // buffer for it, otherwise SRTP will fail later. If SRTP ever uses | 33 // buffer for it, otherwise SRTP will fail later. If SRTP ever uses |
34 // more than this, we need to increase this number. | 34 // more than this, we need to increase this number. |
35 static const size_t kMaxSrtpHmacOverhead = 16; | 35 static const size_t kMaxSrtpHmacOverhead = 16; |
36 | 36 |
37 RtpDataEngine::RtpDataEngine() { | 37 RtpDataEngine::RtpDataEngine() { |
38 data_codecs_.push_back( | 38 data_codecs_.push_back( |
39 DataCodec(kGoogleRtpDataCodecId, | 39 DataCodec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName)); |
40 kGoogleRtpDataCodecName, 0)); | |
41 SetTiming(new rtc::Timing()); | 40 SetTiming(new rtc::Timing()); |
42 } | 41 } |
43 | 42 |
44 DataMediaChannel* RtpDataEngine::CreateChannel( | 43 DataMediaChannel* RtpDataEngine::CreateChannel( |
45 DataChannelType data_channel_type) { | 44 DataChannelType data_channel_type) { |
46 if (data_channel_type != DCT_RTP) { | 45 if (data_channel_type != DCT_RTP) { |
47 return NULL; | 46 return NULL; |
48 } | 47 } |
49 return new RtpDataMediaChannel(timing_.get()); | 48 return new RtpDataMediaChannel(timing_.get()); |
50 } | 49 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 delete iter->second; | 84 delete iter->second; |
86 } | 85 } |
87 } | 86 } |
88 | 87 |
89 void RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) { | 88 void RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) { |
90 *seq_num = ++last_seq_num_; | 89 *seq_num = ++last_seq_num_; |
91 *timestamp = timestamp_offset_ + static_cast<uint32_t>(now * clockrate_); | 90 *timestamp = timestamp_offset_ + static_cast<uint32_t>(now * clockrate_); |
92 } | 91 } |
93 | 92 |
94 const DataCodec* FindUnknownCodec(const std::vector<DataCodec>& codecs) { | 93 const DataCodec* FindUnknownCodec(const std::vector<DataCodec>& codecs) { |
95 DataCodec data_codec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName, 0); | 94 DataCodec data_codec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName); |
96 std::vector<DataCodec>::const_iterator iter; | 95 std::vector<DataCodec>::const_iterator iter; |
97 for (iter = codecs.begin(); iter != codecs.end(); ++iter) { | 96 for (iter = codecs.begin(); iter != codecs.end(); ++iter) { |
98 if (!iter->Matches(data_codec)) { | 97 if (!iter->Matches(data_codec)) { |
99 return &(*iter); | 98 return &(*iter); |
100 } | 99 } |
101 } | 100 } |
102 return NULL; | 101 return NULL; |
103 } | 102 } |
104 | 103 |
105 const DataCodec* FindKnownCodec(const std::vector<DataCodec>& codecs) { | 104 const DataCodec* FindKnownCodec(const std::vector<DataCodec>& codecs) { |
106 DataCodec data_codec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName, 0); | 105 DataCodec data_codec(kGoogleRtpDataCodecId, kGoogleRtpDataCodecName); |
107 std::vector<DataCodec>::const_iterator iter; | 106 std::vector<DataCodec>::const_iterator iter; |
108 for (iter = codecs.begin(); iter != codecs.end(); ++iter) { | 107 for (iter = codecs.begin(); iter != codecs.end(); ++iter) { |
109 if (iter->Matches(data_codec)) { | 108 if (iter->Matches(data_codec)) { |
110 return &(*iter); | 109 return &(*iter); |
111 } | 110 } |
112 } | 111 } |
113 return NULL; | 112 return NULL; |
114 } | 113 } |
115 | 114 |
116 bool RtpDataMediaChannel::SetRecvCodecs(const std::vector<DataCodec>& codecs) { | 115 bool RtpDataMediaChannel::SetRecvCodecs(const std::vector<DataCodec>& codecs) { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 343 |
345 MediaChannel::SendPacket(&packet, rtc::PacketOptions()); | 344 MediaChannel::SendPacket(&packet, rtc::PacketOptions()); |
346 send_limiter_->Use(packet_len, now); | 345 send_limiter_->Use(packet_len, now); |
347 if (result) { | 346 if (result) { |
348 *result = SDR_SUCCESS; | 347 *result = SDR_SUCCESS; |
349 } | 348 } |
350 return true; | 349 return true; |
351 } | 350 } |
352 | 351 |
353 } // namespace cricket | 352 } // namespace cricket |
OLD | NEW |