Change the type of session_id() from string to int64_t.

BUG=webrtc:7311

Review-Url: https://codereview.webrtc.org/2749493002
Cr-Commit-Position: refs/heads/master@{#17215}
This commit is contained in:
zhihuang 2017-03-13 11:00:54 -07:00 committed by Commit bot
parent d92f5ba9a7
commit 30e0da4a65
2 changed files with 7 additions and 10 deletions

View File

@ -19,19 +19,16 @@ namespace webrtc {
// A structured representation of an SDP session description.
class SessionDescription {
public:
SessionDescription(std::string session_id, std::string session_version)
: session_id_(std::move(session_id)),
session_version_(std::move(session_version)) {}
SessionDescription(int64_t session_id, std::string session_version)
: session_id_(session_id), session_version_(std::move(session_version)) {}
// https://tools.ietf.org/html/rfc4566#section-5.2
// o=<username> <sess-id> <sess-version> <nettype> <addrtype>
// <unicast-address>
// session_id_ is the "sess-id" field.
// session_version_ is the "sess-version" field.
const std::string& session_id() const { return session_id_; }
void set_session_id(std::string session_id) {
session_id_ = std::move(session_id);
}
int64_t session_id() { return session_id_; }
void set_session_id(int64_t session_id) { session_id_ = session_id; }
const std::string& session_version() const { return session_version_; }
void set_session_version(std::string session_version) {
@ -39,7 +36,7 @@ class SessionDescription {
}
private:
std::string session_id_;
int64_t session_id_;
std::string session_version_;
};

View File

@ -16,8 +16,8 @@ namespace webrtc {
class SessionDescriptionTest : public testing::Test {};
TEST_F(SessionDescriptionTest, CreateSessionDescription) {
SessionDescription s("a", "0");
EXPECT_EQ("a", s.session_id());
SessionDescription s(-1, "0");
EXPECT_EQ(-1, s.session_id());
EXPECT_EQ("0", s.session_version());
}
}