わかりました、私はこれを何時間も見ていました。私が提供しているデータが完全なコンテキストを提供していない場合は、私に知らせてください。さらにいくつか提供します。
つまり、基本的に、NSData *packetDescDataが指すデータのブロブを取得しました。これは次のようになります。
00000000 00000000 00000007 00000007 00000000 00000016 0000001d 00000000 0000001a 00000037 00000000
0000002a 00000061 00000000 00000025 00000086 00000000 00000029 000000af 00000000 00000032 000000e1
00000000 00000027 00000108 00000000 00000038 00000140 00000000 00000031 00000171 00000000 0000001e
0000018f 00000000 00000035 000001c4 00000000 00000027 000001eb 00000000 0000002d 00000218 00000000
00000031 00000249 00000000 00000026 0000026f 00000000 00000033 000002a2 00000000 00000037 000002d9
00000000 00000035 0000030e 00000000 0000002c 0000033a 00000000 00000025 0000035f 00000000 00000020
0000037f 00000000 00000034 000003b3 00000000 0000005d
特定のオフセットからデータを読み取り、それらをさまざまな変数に割り当てるループを実行します:(ログステートメントとともに):
for (int i=0; i < packetDescNumber; i++) {
packetDescs[i].mStartOffset = [packetDescData rw_int32AtOffset:offset];
offset += sizeof(UInt32);
NSLog(@"packetDescriptionArray[%d].mStartOffset: %lld, fillbuffindex: %d, offset %lu", i,packetDescs[i].mStartOffset, fillBufferIndex, offset);
packetDescs[i].mVariableFramesInPacket = [packetDescData rw_int32AtOffset:offset];
offset += sizeof(UInt32);
NSLog(@"packetDescriptionArray[%d].mVariableFramesInPacket: %lu, fillbuffindex: %d, offset %lu", i,packetDescs[i].mVariableFramesInPacket, fillBufferIndex, offset);
packetDescs[i].mDataByteSize = [packetDescData rw_int32AtOffset:offset];
offset += sizeof(UInt32);
NSLog(@"packetDescriptionArray[%d].mDataByteSize: %lu, fillbuffindex: %d, offset %lu", i,packetDescs[i].mDataByteSize, fillBufferIndex, offset);
NSLog(@"-------------------------------------------------------\n\n\n\n");
}
rw_int32AtOffsetは次のように定義されます。
- (int)rw_int32AtOffset:(size_t)offset
{
const int *intBytes = (const int *)[self bytes];
return ntohl(intBytes[offset / 4]);
}
出力はこれです(同じスレッド上の他の確率変数(fillbuffindex)..がpacketDescriptionArray [6] .mStartOffsetでmStartOffsetが175になると、その値をmStartOffsetと同じ値に突然変更することに注意してください。
packetDescriptionArray[4].mStartOffset: 97, fillbuffindex: 0, offset 52
MAIN: we are appending 1231 bytes to ring buffer
MAIN: appendToRingBuffer: FILLBUFFERINDEX: 0
packetDescriptionArray[4].mVariableFramesInPacket: 0, fillbuffindex: 0, offset 56
packetDescriptionArray[4].mDataByteSize: 37, fillbuffindex: 0, offset 60
-------------------------------------------------------
packetDescriptionArray[5].mStartOffset: 134, fillbuffindex: 0, offset 64
packetDescriptionArray[5].mVariableFramesInPacket: 0, fillbuffindex: 0, offset 68
packetDescriptionArray[5].mDataByteSize: 41, fillbuffindex: 0, offset 72
-------------------------------------------------------
packetDescriptionArray[6].mStartOffset: 175, fillbuffindex: 175, offset 76
packetDescriptionArray[6].mVariableFramesInPacket: 0, fillbuffindex: 175, offset 80
packetDescriptionArray[6].mDataByteSize: 50, fillbuffindex: 175, offset 84
-------------------------------------------------------
packetDescriptionArray[7].mStartOffset: 225, fillbuffindex: 175, offset 88
packetDescriptionArray[7].mVariableFramesInPacket: 0, fillbuffindex: 175, offset 92
packetDescriptionArray[7].mDataByteSize: 39, fillbuffindex: 175, offset 96
-------------------------------------------------------
MAIN: we are appending 1224 bytes to ring buffer
MAIN: appendToRingBuffer: FILLBUFFERINDEX: 175
packetDescriptionArray[8].mStartOffset: 264, fillbuffindex: 175, offset 100
packetDescriptionArray[8].mVariableFramesInPacket: 0, fillbuffindex: 175, offset 104
packetDescriptionArray[8].mDataByteSize: 56, fillbuffindex: 175, offset 108
-------------------------------------------------------
重要なのは、別のスレッドのリングバッファに追加する MAIN: we are appending 1231 bytes to ring buffer
ことです。リングバッファはスレッド間で共有されますが、fillbuffindexとは何の関係もありません。何かアイデアはありますか?