[xiph-commits] r8014 - in trunk/oggdsf/src/lib/core:
directshow/dsfOggMux ogg/libOOOgg
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Fri Oct 15 07:23:53 PDT 2004
Author: illiminable
Date: 2004-10-15 07:23:52 -0700 (Fri, 15 Oct 2004)
New Revision: 8014
Modified:
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp
Log:
* Fixed a bug in the paginator, where if the page ran out of space by virtue of running out of segments (ie many small packets) before it reached the minimum page size, it would go into an infinite loop.
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp 2004-10-15 14:06:09 UTC (rev 8013)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp 2004-10-15 14:23:52 UTC (rev 8014)
@@ -75,13 +75,16 @@
HRESULT OggMuxInputPin::SetMediaType(const CMediaType* inMediaType) {
if ((inMediaType->majortype == MEDIATYPE_Video) && (inMediaType->subtype == MEDIASUBTYPE_Theora)) {
//Theora
+
sTheoraFormatBlock* locTheora = (sTheoraFormatBlock*)inMediaType->pbFormat;
+ debugLog<<"Theo sample rate = "<<locTheora->frameRateNumerator<<" / "<<locTheora->frameRateDenominator<<endl;
mMuxStream->setConversionParams(locTheora->frameRateNumerator, locTheora->frameRateDenominator, 10000000, locTheora->maxKeyframeInterval);
} else if (inMediaType->majortype == MEDIATYPE_Audio) {
if (inMediaType->subtype == MEDIASUBTYPE_Vorbis) {
//Vorbis
sVorbisFormatBlock* locVorbis = (sVorbisFormatBlock*)inMediaType->pbFormat;
+ debugLog<<"Vorbis sample rate = "<<locVorbis->samplesPerSec<<endl;
mMuxStream->setConversionParams(locVorbis->samplesPerSec, 1, 10000000);
} else if (inMediaType->subtype == MEDIASUBTYPE_Speex) {
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp 2004-10-15 14:06:09 UTC (rev 8013)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp 2004-10-15 14:23:52 UTC (rev 8014)
@@ -334,14 +334,23 @@
//The amount of space left in the page is the minimum of
// a) The number of segments left * 255
// b) The number of bytes less than the desired maximum page size.
+
+ debugLog<<"Remains in packet = "<<inRemaining<<endl;
+ debugLog<<"Start at = "<<inStartAt<<endl;
+ debugLog<<"Segtable size = "<<mSegmentTableSize<<endl;
+ debugLog<<"Max page size = "<<mSettings->mMaxPageSize<<endl;
+ debugLog<<"Current page size = "<<mCurrentPageSize<<endl;
+
unsigned long locSpaceLeft = MIN(((255 - mSegmentTableSize) * 255) - 1, mSettings->mMaxPageSize - mCurrentPageSize);
+ debugLog<<"Space left = "<<locSpaceLeft<<endl;
//debugLog<<"Space left = "<<locSpaceLeft<<endl;
//Round down to nearest multiple of 255
//
//This is important when the packet gets broken because inRemaining is gt locSpace left
// In this case where the packet gets broken the final segment on the page must be 255.
locSpaceLeft -= (locSpaceLeft % 255);
+ debugLog<<"Adjust space left = "<<locSpaceLeft<<endl;
//How much we add is the minimum of
// a) How much space is left
@@ -350,17 +359,21 @@
//If (a) is the minimum then we know that the how much we are adding is a multiple of 255.
unsigned long locHowMuchToAdd = MIN(locSpaceLeft, inRemaining);
+ debugLog<<"How much to add..."<<endl;
//debugLog<<"How much to add = "<<locHowMuchToAdd<<endl;
//mPending page has data is useless, it was set before this function is called... need to fix that. maybe move into add part of pack into apge
if ((!mPendingPageHasData) && (inStartAt != 0)) {
mPendingPage->header()->setHeaderFlags(mPendingPage->header()->HeaderFlags() | 1);
}
- addPartOfPacketToPage(inOggPacket, inStartAt, locHowMuchToAdd);
+ if (locHowMuchToAdd > 0) {
+ addPartOfPacketToPage(inOggPacket, inStartAt, locHowMuchToAdd);
+ }
+
//This puts only a single packet on the first page...
- if ((mCurrentPageSize >= mSettings->mMinPageSize) || (mPendingPage->header()->PageSequenceNo() == 0)) {
+ if ((mCurrentPageSize >= mSettings->mMinPageSize) || (mPendingPage->header()->PageSequenceNo() == 0) || (locHowMuchToAdd == 0)) {
deliverCurrentPage();
}
return locHowMuchToAdd;
More information about the commits
mailing list