Dartium build error in Release mode


I was following http://code.google.com/p/dart/wiki/BuildingDartium#Build and attempted to build dartium in Release mode and encountered the following error:

$ ./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>
  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

But when I looked at the code dartium/src/third_party/webrtc/modules/video_coding/main/source/session_info.cc::VCMSessionInfo::PrepareForDecode(), I saw the following:

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 =

        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;
        } 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);
                  (*it).dataPtr + 1, (*it).sizeBytes - 1);
          ShiftSubsequentPackets(it, -1);
          previous_lost = false;
          real_data_bytes += (*it).sizeBytes;
      } else {

        memset(const_cast<uint8_t*>((*it).dataPtr), 0,
        previous_lost = true;
    } 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.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;

The bool variable previous_lost has been used (set to false and true) at many places.

Any valuable input on how to go about this would be a great help.


Setting a bool to true or false is pointless if you don’t then read the value later – in the code you posted, a value for previous_lost is indeed set in several places, but nowhere is the value that’s set used to do anything (such as a if (previous_lost) ..., for example). That’s what’s meant by “used” in this context: a variable is used if its value is read.

Note that this (generally) applies for any type of variable: if I set an int to 42 and don’t use it any later calculation, it’s not “used” either.

In these cases, the variable is completely redundant – it does nothing useful since it is not used by other code. Generally this kind of warning is meant to indicate that perhaps the code that was supposed to use previous_lost was accidentally omitted (or was removed) and needs to be accounted for. Alternatively, the variable might simply be redundant and can be removed entirely.

Answered By – Mac

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *