Checks the packet table to see whether the specified trace matches the packet context for the specified frame. The matching algorithm used (empirically established) : Matching is based on packet size, packet flags, file pointer position after reading the packet, and the packet's source stream. If the specified trace contains more than one video stream packet, the first one is not required to match on either size or flags. The same goes for the first but not only non-video packet. File positions need not match exactly, but they may not exceed the next first key frame's post-read file position. Definition at line 728 of file VideoAccessStrategy.h. References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get2(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get3(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get4(), ILOG_DEBUG, mFrames, mPackets, and Impala::Core::Table::Table::Size(). Referenced by CurrentFrameMatchesFrame(). 00729 { 00730 const int nrOfFrames = mFrames->Size(); 00731 if (frameNr < 0 || frameNr >= nrOfFrames) 00732 return false; 00733 00734 //if (!FrameIsKey(frameNr)) 00735 // return false; 00736 00737 const int traceLen = trace.Size(); 00738 00739 int nrOfVideoPackets = 0; 00740 for (int t = 0; t < traceLen; t++) 00741 if (trace.Get4(t)) 00742 nrOfVideoPackets++; 00743 int nrOfNonVideoPackets = traceLen - nrOfVideoPackets; 00744 00745 int packetIdx = mFrames->Get2(frameNr); 00746 for (int t = traceLen - 1; t >= 0; t--) 00747 { 00748 if (packetIdx < 0) 00749 return false; 00750 00751 const int sizeFromPackets = mPackets->Get2(packetIdx); 00752 const int sizeFromTrace = trace.Get1(t); 00753 const int flagsFromPackets = mPackets->Get3(packetIdx); 00754 const int flagsFromTrace = trace.Get2(t); 00755 bool sizeAndFlagsMatch = 00756 (sizeFromPackets == sizeFromTrace && 00757 flagsFromPackets == flagsFromTrace); 00758 00759 if (trace.Get4(t)) // from video stream? 00760 { 00761 if (--nrOfVideoPackets <= 0) 00762 sizeAndFlagsMatch = true; 00763 } 00764 else 00765 if (--nrOfNonVideoPackets <= 0) 00766 sizeAndFlagsMatch = true; 00767 00768 if (!sizeAndFlagsMatch) 00769 { 00770 ILOG_DEBUG("Size and/or flags don't match at trace pos " << t << 00771 " of " << traceLen << " : " << sizeFromPackets << 00772 " vs. " << sizeFromTrace << " ; " << flagsFromPackets << 00773 " vs. " << flagsFromTrace); 00774 return false; 00775 } 00776 00777 packetIdx--; 00778 00779 // SK: trace matching appears not to be trivial; use only last trace entry 00780 break; 00781 } 00782 00783 // test match for post-read file position 00784 packetIdx = mFrames->Get2(frameNr); 00785 const UInt64 postReadPosOfFrame = mPackets->Get4(packetIdx); 00786 const UInt64 lastPosOfTrace = trace.Get3(traceLen - 1); 00787 if (lastPosOfTrace > postReadPosOfFrame) 00788 { 00789 // locate next key frame 00790 int nextKeyFrame = frameNr + 1; 00791 for ( ; nextKeyFrame < nrOfFrames; nextKeyFrame++) 00792 if (mFrames->Get4(nextKeyFrame)) // is key frame? 00793 break; 00794 if (nextKeyFrame >= nrOfFrames) 00795 return true; // assume a match if no more key frames 00796 00797 // check current (post-read) file position against 00798 // post-read-position of next key frame 00799 packetIdx = mFrames->Get2(nextKeyFrame); 00800 const UInt64 nextKeyFramesFilePos = mPackets->Get4(packetIdx); 00801 if (lastPosOfTrace > nextKeyFramesFilePos) 00802 return false; 00803 } 00804 00805 return true; 00806 }
Here is the call graph for this function:
|