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( + 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(rtc::NetworkToHost64(1 << 16)); EXPECT_EQ(be64_index, index); }