File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 11
11
#include " rtc/rtc.hpp"
12
12
13
13
#include < fstream>
14
+ #include < cstring>
14
15
15
16
#ifdef _WIN32
16
17
#include < winsock2.h>
@@ -29,7 +30,9 @@ void H264FileParser::loadNextSample() {
29
30
while (i < sample.size ()) {
30
31
assert (i + 4 < sample.size ());
31
32
auto lengthPtr = (uint32_t *) (sample.data () + i);
32
- uint32_t length = ntohl (*lengthPtr);
33
+ uint32_t length;
34
+ std::memcpy (&length, lengthPtr, sizeof (uint32_t ));
35
+ length = ntohl (length);
33
36
auto naluStartIndex = i + 4 ;
34
37
auto naluEndIndex = naluStartIndex + length;
35
38
assert (naluEndIndex <= sample.size ());
Original file line number Diff line number Diff line change @@ -32,8 +32,9 @@ shared_ptr<NalUnits> H264RtpPacketizer::splitMessage(binary_ptr message) {
32
32
LOG_WARNING << " Invalid NAL Unit data (incomplete length), ignoring!" ;
33
33
break ;
34
34
}
35
- auto lengthPtr = (uint32_t *)(message->data () + index );
36
- uint32_t length = ntohl (*lengthPtr);
35
+ uint32_t length;
36
+ std::memcpy (&length, message->data () + index , sizeof (uint32_t ));
37
+ length = ntohl (length);
37
38
auto naluStartIndex = index + 4 ;
38
39
auto naluEndIndex = naluStartIndex + length;
39
40
You can’t perform that action at this time.
0 commit comments