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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h

Issue 1439553003: [rtp_rtcp] rtcp::Sdes cleaned and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h
new file mode 100644
index 0000000000000000000000000000000000000000..eaa856eb21e8288054485f6f6e78618f4ed2eee1
--- /dev/null
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ *
+ */
+
+#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_
+
+#include <string>
+#include <vector>
+
+#include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
+#include "webrtc/typedefs.h"
+
+namespace webrtc {
+namespace rtcp {
+
+class Sdes : public RtcpPacket {
+ public:
+ static const uint8_t kPacketType = 202;
+
+ Sdes() : RtcpPacket() {}
+
+ virtual ~Sdes() {}
+
+ // Parse assumes header is already parsed and validated.
+ bool Parse(const RTCPUtility::RtcpCommonHeader& header,
+ const uint8_t* payload); // Size of the payload is in the header.
+
+ bool WithCName(uint32_t ssrc, const std::string& cname);
+
+ struct Chunk {
+ uint32_t ssrc;
+ std::string name;
+ };
+
+ size_t chunks_count() const { return chunks_.size(); }
+ const Chunk& chunk(size_t index) const { return chunks_[index]; }
sprang_webrtc 2015/11/12 15:27:15 Could we just return a const std::vector<Chunk>& i
danilchap 2015/11/12 16:59:09 I do not want to disclose to user that vector is u
sprang_webrtc 2015/11/16 09:50:34 I get the sentiment, but I think this is premature
danilchap 2015/11/17 10:50:48 Done.
+
+ protected:
+ bool Create(uint8_t* packet,
+ size_t* index,
+ size_t max_length,
+ RtcpPacket::PacketReadyCallback* callback) const override;
+
+ private:
+ static const int kMaxNumberOfChunks = 0x1f;
+
+ size_t BlockLength() const override;
+
+ std::vector<Chunk> chunks_;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(Sdes);
+};
+
+} // namespace rtcp
+} // namespace webrtc
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_

Powered by Google App Engine
This is Rietveld 408576698