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:
parent
3eba2d8273
commit
7aeabd081f
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user