gpt4 book ai didi

c++ - Release模式下的 Dartium 构建错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:13:23 25 4
gpt4 key购买 nike

我正在关注 http://code.google.com/p/dart/wiki/BuildingDartium#Build并尝试在 Release 模式下构建 dartium 并遇到以下错误:

$ ./dartium_tools/build.py --mode=Release
.
.
.
CXX(target) out/Release/obj.target/webrtc_video_coding/third_party/webrtc/modules/video_coding/main/source/rtt_filter.o
CXX(target) out/Release/obj.target/webrtc_video_coding/third_party/webrtc/modules/video_coding/main/source/session_info.o
CXX(target) out/Release/obj.target/webrtc_video_coding/third_party/webrtc/modules/video_coding/main/source/timestamp_extrapolator.o
third_party/webrtc/modules/video_coding/main/source/session_info.cc: In member function ‘int webrtc::VCMSessionInfo::PrepareForDecode(uint8_t*)’:
third_party/webrtc/modules/video_coding/main/source/session_info.cc:590:8: error: variable ‘previous_lost’ set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors

make: *** [out/Release/obj.target/webrtc_video_coding/third_party/webrtc/modules/video_coding/main/source/session_info.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "./dartium_tools/build.py", line 67, in <module>
main()
File "./dartium_tools/build.py", line 64, in main
[target for (target, _) in targets])
File "/home/sangeeth/work/g/dartium/src/dartium_tools/utils.py", line 97, in runCommand
raise Exception('Failed to run command. return code=%s' % p.returncode)
Exception: Failed to run command. return code=2
$

但是当我查看代码 dartium/src/third_party/webrtc/modules/video_coding/main/source/session_info.cc::VCMSessionInfo::PrepareForDecode() 时,我看到了以下内容:

int VCMSessionInfo::PrepareForDecode(uint8_t* frame_buffer) {
int length = SessionLength();
int real_data_bytes = 0;
if (length == 0)
return length;
bool previous_lost = false;
PacketIterator it = packets_.begin();
PacketIterator prev_it = it;
for (; it != packets_.end(); ++it) {
bool packet_loss = ((*prev_it).sizeBytes == 0 ||
!InSequence(it, prev_it));
if ((*it).bits) {
if (prev_it != it) { // Not the first packet.
uint8_t* ptr_first_byte =
const_cast<uint8_t*>((*it).dataPtr);

if (packet_loss) {
// It is be better to throw away this packet if we are
// missing the previous packet.
memset(ptr_first_byte, 0, (*it).sizeBytes);
previous_lost = true;
++packets_not_decodable_;
} else if ((*it).sizeBytes > 0) {
// Glue with previous byte.
// Move everything from [this packet start + 1, end of buffer] one
// byte to the left.
uint8_t* ptr_prev_byte =
const_cast<uint8_t*>((*prev_it).dataPtr) +
(*prev_it).sizeBytes - 1;
*ptr_prev_byte = (*ptr_prev_byte) | (*ptr_first_byte);
memmove(const_cast<uint8_t*>((*it).dataPtr),
(*it).dataPtr + 1, (*it).sizeBytes - 1);
ShiftSubsequentPackets(it, -1);
(*it).sizeBytes--;
length--;
previous_lost = false;
real_data_bytes += (*it).sizeBytes;
}
} else {

memset(const_cast<uint8_t*>((*it).dataPtr), 0,
(*it).sizeBytes);
previous_lost = true;
++packets_not_decodable_;
}
} else if (packet_loss &&
(*it).codecSpecificHeader.codec == kRTPVideoH263) {
// Pad H.263 packet losses with 10 zeros to make it easier
// for the decoder.
const int kPaddingLength = 10;
WebRtc_UWord8 padding_data[kPaddingLength] = {0};
// Make a copy of the previous packet.
VCMPacket padding_packet(*it);
++padding_packet.seqNum;
padding_packet.dataPtr = padding_data;
padding_packet.sizeBytes = kPaddingLength;
length += InsertPacket(padding_packet, frame_buffer, false, 0);
previous_lost = true;
} else {
real_data_bytes += (*it).sizeBytes;
previous_lost = false;
}
prev_it = it;
}
if (real_data_bytes == 0) {
// Drop the frame since all it contains are zeros.
for (it = packets_.begin(); it != packets_.end(); ++it)
(*it).sizeBytes = 0;
length = 0;
}
return length;
}

bool 变量 previous_lost 已在许多地方使用(设置为 falsetrue)。

任何关于如何解决这个问题的宝贵意见都会有很大的帮助。

最佳答案

bool 设置为 truefalse 是没有意义的,如果您稍后不读取该值 - 在您发布的代码中, previous_lost 的值确实在多个位置设置,但设置的值没有任何地方用于执行任何操作(例如 if (previous_lost) ...,例如).这就是本文中“使用”的含义:如果读取变量的值,则使用该变量。

请注意,这(通常)适用于任何类型的变量:如果我将 int 设置为 42 并且在以后的计算中不使用它,它不是“用过”。

在这些情况下,变量是完全多余的——它没有任何用处,因为它没有被其他代码使用。一般来说,这种警告意味着可能应该使用 previous_lost 的代码被意外遗漏(或被删除)并且需要说明。或者,该变量可能只是多余的,可以完全删除。

关于c++ - Release模式下的 Dartium 构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8813986/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com