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

Side by Side Diff: talk/session/media/bundlefilter.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/session/media/bundlefilter.h ('k') | talk/session/media/channel.h » ('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 2004 Google Inc. 3 * Copyright 2004 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 14 matching lines...) Expand all
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "talk/session/media/bundlefilter.h" 28 #include "talk/session/media/bundlefilter.h"
29 29
30 #include "talk/media/base/rtputils.h" 30 #include "talk/media/base/rtputils.h"
31 #include "webrtc/base/logging.h" 31 #include "webrtc/base/logging.h"
32 32
33 namespace cricket { 33 namespace cricket {
34 34
35 static const uint32 kSsrc01 = 0x01; 35 static const uint32_t kSsrc01 = 0x01;
36 36
37 BundleFilter::BundleFilter() { 37 BundleFilter::BundleFilter() {
38 } 38 }
39 39
40 BundleFilter::~BundleFilter() { 40 BundleFilter::~BundleFilter() {
41 } 41 }
42 42
43 bool BundleFilter::DemuxPacket(const char* data, size_t len, bool rtcp) { 43 bool BundleFilter::DemuxPacket(const char* data, size_t len, bool rtcp) {
44 // For rtp packets, we check whether the payload type can be found. 44 // For rtp packets, we check whether the payload type can be found.
45 // For rtcp packets, we check whether the ssrc can be found or is the special 45 // For rtcp packets, we check whether the ssrc can be found or is the special
46 // value 1 except for SDES packets which always pass through. Plus, if 46 // value 1 except for SDES packets which always pass through. Plus, if
47 // |streams_| is empty, we will allow all rtcp packets pass through provided 47 // |streams_| is empty, we will allow all rtcp packets pass through provided
48 // that they are valid rtcp packets in case that they are for early media. 48 // that they are valid rtcp packets in case that they are for early media.
49 if (!rtcp) { 49 if (!rtcp) {
50 // It may not be a RTP packet (e.g. SCTP). 50 // It may not be a RTP packet (e.g. SCTP).
51 if (!IsRtpPacket(data, len)) 51 if (!IsRtpPacket(data, len))
52 return false; 52 return false;
53 53
54 int payload_type = 0; 54 int payload_type = 0;
55 if (!GetRtpPayloadType(data, len, &payload_type)) { 55 if (!GetRtpPayloadType(data, len, &payload_type)) {
56 return false; 56 return false;
57 } 57 }
58 return FindPayloadType(payload_type); 58 return FindPayloadType(payload_type);
59 } 59 }
60 60
61 // Rtcp packets using ssrc filter. 61 // Rtcp packets using ssrc filter.
62 int pl_type = 0; 62 int pl_type = 0;
63 uint32 ssrc = 0; 63 uint32_t ssrc = 0;
64 if (!GetRtcpType(data, len, &pl_type)) return false; 64 if (!GetRtcpType(data, len, &pl_type)) return false;
65 if (pl_type == kRtcpTypeSDES) { 65 if (pl_type == kRtcpTypeSDES) {
66 // SDES packet parsing not supported. 66 // SDES packet parsing not supported.
67 LOG(LS_INFO) << "SDES packet received for demux."; 67 LOG(LS_INFO) << "SDES packet received for demux.";
68 return true; 68 return true;
69 } else { 69 } else {
70 if (!GetRtcpSsrc(data, len, &ssrc)) return false; 70 if (!GetRtcpSsrc(data, len, &ssrc)) return false;
71 if (ssrc == kSsrc01) { 71 if (ssrc == kSsrc01) {
72 // SSRC 1 has a special meaning and indicates generic feedback on 72 // SSRC 1 has a special meaning and indicates generic feedback on
73 // some systems and should never be dropped. If it is forwarded 73 // some systems and should never be dropped. If it is forwarded
(...skipping 11 matching lines...) Expand all
85 85
86 bool BundleFilter::AddStream(const StreamParams& stream) { 86 bool BundleFilter::AddStream(const StreamParams& stream) {
87 if (GetStreamBySsrc(streams_, stream.first_ssrc())) { 87 if (GetStreamBySsrc(streams_, stream.first_ssrc())) {
88 LOG(LS_WARNING) << "Stream already added to filter"; 88 LOG(LS_WARNING) << "Stream already added to filter";
89 return false; 89 return false;
90 } 90 }
91 streams_.push_back(stream); 91 streams_.push_back(stream);
92 return true; 92 return true;
93 } 93 }
94 94
95 bool BundleFilter::RemoveStream(uint32 ssrc) { 95 bool BundleFilter::RemoveStream(uint32_t ssrc) {
96 return RemoveStreamBySsrc(&streams_, ssrc); 96 return RemoveStreamBySsrc(&streams_, ssrc);
97 } 97 }
98 98
99 bool BundleFilter::HasStreams() const { 99 bool BundleFilter::HasStreams() const {
100 return !streams_.empty(); 100 return !streams_.empty();
101 } 101 }
102 102
103 bool BundleFilter::FindStream(uint32 ssrc) const { 103 bool BundleFilter::FindStream(uint32_t ssrc) const {
104 return ssrc == 0 ? false : GetStreamBySsrc(streams_, ssrc) != nullptr; 104 return ssrc == 0 ? false : GetStreamBySsrc(streams_, ssrc) != nullptr;
105 } 105 }
106 106
107 bool BundleFilter::FindPayloadType(int pl_type) const { 107 bool BundleFilter::FindPayloadType(int pl_type) const {
108 return payload_types_.find(pl_type) != payload_types_.end(); 108 return payload_types_.find(pl_type) != payload_types_.end();
109 } 109 }
110 110
111 void BundleFilter::ClearAllPayloadTypes() { 111 void BundleFilter::ClearAllPayloadTypes() {
112 payload_types_.clear(); 112 payload_types_.clear();
113 } 113 }
114 114
115 } // namespace cricket 115 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/session/media/bundlefilter.h ('k') | talk/session/media/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698