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}
This commit is contained in:
parent
4825356620
commit
4b3c0d6f34
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user