質問

私はフォローしていました http://code.google.com/p/dart/wiki/buildingdartium#build そして、構築しようとしました dartiumRelease モードと次のエラーが発生しました。

$ ./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)多くの場所で。

これをどのように進めるかについての貴重な入力は、大きな助けになるでしょう。

役に立ちましたか?

解決

設定a booltrue また false あなたがしない場合、あなたが後で値を読んでいない場合 - あなたが投稿したコードで、の値はの値です previous_lost 確かにいくつかの場所に設定されていますが、何でもするために使用される値はどこにもありません( if (previous_lost) ..., 、 例えば)。これは、このコンテキストで「使用」の意味です。値が読み取られた場合に変数が使用されます。

これは(一般的に)あらゆるタイプの変数に適用されることに注意してください: int42 また、後の計算を使用しないでください。また、「使用」されていません。

これらの場合、変数は完全に冗長です - 他のコードでは使用されていないため、それは何も役に立ちません。一般的に、この種の警告は、おそらく使用することになっていたコードを示すことを目的としています previous_lost 誤って省略されていた(または削除された)ため、説明する必要があります。あるいは、変数は単に冗長であり、完全に削除することができます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top