繁体   English   中英

发布模式下的Dartium构建错误

[英]Dartium build error in Release mode

我正在关注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的代码被意外省略(或删除)并需要考虑。 另外,变量可能只是多余的,可以完全删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM