Add CryptoParams to webrtc::MediaSession.

SrtpTransportInterface methods take cricket::CryptoParams, so this
should be enough for now.

BUG=webrtc:7311

Review-Url: https://codereview.webrtc.org/2753343002
Cr-Commit-Position: refs/heads/master@{#17299}
This commit is contained in:
zstein 2017-03-17 19:10:37 -07:00 committed by Commit bot
parent 3eba2d8273
commit 7aeabd081f
2 changed files with 20 additions and 0 deletions

View File

@ -13,8 +13,10 @@
#include <string>
#include <utility>
#include <vector>
#include "webrtc/base/optional.h"
#include "webrtc/media/base/cryptoparams.h"
namespace webrtc {
@ -32,8 +34,18 @@ class MediaDescription {
rtc::Optional<std::string> mid() const { return mid_; }
void set_mid(std::string mid) { mid_.emplace(std::move(mid)); }
// Security keys and parameters for this media stream. Can be used to
// negotiate parameters for SRTP.
// https://tools.ietf.org/html/rfc4568#page-5
std::vector<cricket::CryptoParams>& sdes_params() { return sdes_params_; }
const std::vector<cricket::CryptoParams>& sdes_params() const {
return sdes_params_;
}
private:
rtc::Optional<std::string> mid_;
std::vector<cricket::CryptoParams> sdes_params_;
};
} // namespace webrtc

View File

@ -19,4 +19,12 @@ TEST_F(MediaDescriptionTest, CreateMediaDescription) {
MediaDescription m("a");
EXPECT_EQ("a", m.mid());
}
TEST_F(MediaDescriptionTest, AddSdesParam) {
MediaDescription m("a");
m.sdes_params().push_back(cricket::CryptoParams());
const std::vector<cricket::CryptoParams>& params = m.sdes_params();
EXPECT_EQ(1u, params.size());
}
} // namespace webrtc