diff options
author | Jiayang Liu <jiayl@chromium.org> | 2015-03-31 15:02:42 -0700 |
---|---|---|
committer | Jiayang Liu <jiayl@chromium.org> | 2015-03-31 22:02:50 +0000 |
commit | 4b3c0d6f34c379c2a06f654b62403876b20180c6 (patch) | |
tree | c4075bd51595d50a6c16f091f5445fa4144f7f6e /talk/session | |
parent | 4825356620887946f289cb16f2095878be04a125 (diff) | |
download | webrtc-4b3c0d6f34c379c2a06f654b62403876b20180c6.tar.gz |
Use WebRTC API to convert byteorder in srtpfilter.
This CL uses WebRTC API to convert 64bit from big-endian to host-endian,
so the internal "be64_to_cpu" of libsrtp is not used. The code path of
"be64_to_cpu" in newer versions of libsrtp depends on compile-time
defines that are not available in WebRTC.
BUG=https://code.google.com/p/chromium/issues/detail?id=328475
R=juberti@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/46749004
Cr-Commit-Position: refs/heads/master@{#8904}
Diffstat (limited to 'talk/session')
-rw-r--r-- | talk/session/media/srtpfilter.cc | 4 | ||||
-rw-r--r-- | talk/session/media/srtpfilter_unittest.cc | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/talk/session/media/srtpfilter.cc b/talk/session/media/srtpfilter.cc index 8beec10459..a49b037734 100644 --- a/talk/session/media/srtpfilter.cc +++ b/talk/session/media/srtpfilter.cc @@ -35,6 +35,7 @@ #include "talk/media/base/rtputils.h" #include "webrtc/base/base64.h" +#include "webrtc/base/byteorder.h" #include "webrtc/base/logging.h" #include "webrtc/base/stringencode.h" #include "webrtc/base/timeutils.h" @@ -628,7 +629,8 @@ bool SrtpSession::GetSendStreamPacketIndex(void* p, int in_len, int64* index) { return false; // Shift packet index, put into network byte order - *index = be64_to_cpu(rdbx_get_packet_index(&stream->rtp_rdbx) << 16); + *index = static_cast<int64>( + rtc::NetworkToHost64(rdbx_get_packet_index(&stream->rtp_rdbx) << 16)); return true; } diff --git a/talk/session/media/srtpfilter_unittest.cc b/talk/session/media/srtpfilter_unittest.cc index f3b7625c22..d8174a978a 100644 --- a/talk/session/media/srtpfilter_unittest.cc +++ b/talk/session/media/srtpfilter_unittest.cc @@ -35,10 +35,8 @@ extern "C" { #ifdef SRTP_RELATIVE_PATH #include "crypto/include/err.h" -#include "crypto/include/datatypes.h" #else #include "third_party/libsrtp/srtp/crypto/include/err.h" -#include "third_party/libsrtp/srtp/crypto/include/datatypes.h" #endif } @@ -676,7 +674,7 @@ TEST_F(SrtpSessionTest, TestGetSendStreamPacketIndex) { EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_), &out_len, &index)); // |index| will be shifted by 16. - int64 be64_index = be64_to_cpu(1 << 16); + int64 be64_index = static_cast<int64>(rtc::NetworkToHost64(1 << 16)); EXPECT_EQ(be64_index, index); } |