diff -uNr vlc-trunk.orig/live/liveMedia/StreamParser.cpp vlc-trunk.work/live/liveMedia/StreamParser.cpp
--- vlc-trunk.orig/live/liveMedia/StreamParser.cpp	2006-07-04 14:40:17.000000000 +0100
+++ vlc-trunk.work/live/liveMedia/StreamParser.cpp	2006-07-04 15:33:30.000000000 +0100
@@ -41,6 +41,7 @@
   fBank[1] = new unsigned char[BANK_SIZE];
   fCurBankNum = 0;
   fCurBank = fBank[fCurBankNum];
+  MAX_PACKET_SIZE = 512;
 }
 
 StreamParser::~StreamParser() {
@@ -53,15 +54,23 @@
   // We need to read some more bytes from the input source.
   // First, clarify how much data to ask for:
   unsigned maxInputFrameSize = fInputSource->maxFrameSize();
+  unsigned bufSpaceNeeded;
   if (maxInputFrameSize > numBytesNeeded) numBytesNeeded = maxInputFrameSize;
 
+  // Check if our frame size or expected max packet sizes are the limiting factor
+  // on whether we've enough room in our current bank.
+  if (MAX_PACKET_SIZE > numBytesNeeded)
+    bufSpaceNeeded = MAX_PACKET_SIZE;
+  else
+    bufSpaceNeeded = numBytesNeeded;
+
   // First, check whether these new bytes would overflow the current
   // bank.  If so, start using a new bank now.
-  if (fCurParserIndex + numBytesNeeded > BANK_SIZE) {
+  if (fCurParserIndex + bufSpaceNeeded > BANK_SIZE ) {
     // Swap banks, but save any still-needed bytes from the old bank:
     unsigned numBytesToSave = fTotNumValidBytes - fSavedParserIndex;
     unsigned char const* from = &curBank()[fSavedParserIndex];
-    
+
     fCurBankNum = (fCurBankNum + 1)%2;
     fCurBank = fBank[fCurBankNum];
     memmove(curBank(), from, numBytesToSave);
@@ -106,6 +115,9 @@
       << numBytesRead << " bytes; expected no more than "
       << BANK_SIZE - buffer->fTotNumValidBytes << "\n";
   }
+  // Check if we're receiving larger packets than expected
+  if ( numBytesRead > buffer->MAX_PACKET_SIZE)
+      buffer->MAX_PACKET_SIZE = numBytesRead;
 
   unsigned char* ptr = &buffer->curBank()[buffer->fTotNumValidBytes];
   buffer->fTotNumValidBytes += numBytesRead;
Binary files vlc-trunk.orig/live/liveMedia/.StreamParser.cpp.swp and vlc-trunk.work/live/liveMedia/.StreamParser.cpp.swp differ
diff -uNr vlc-trunk.orig/live/liveMedia/StreamParser.hh vlc-trunk.work/live/liveMedia/StreamParser.hh
--- vlc-trunk.orig/live/liveMedia/StreamParser.hh	2006-07-04 14:40:17.000000000 +0100
+++ vlc-trunk.work/live/liveMedia/StreamParser.hh	2006-07-04 15:19:52.000000000 +0100
@@ -132,6 +132,7 @@
   // The current position of the parser within the current bank:
   unsigned fCurParserIndex; // <= fTotNumValidBytes
   unsigned char fRemainingUnparsedBits; // in previous byte: [0,7]
+  unsigned MAX_PACKET_SIZE;
 
   // The total number of valid bytes stored in the current bank:
   unsigned fTotNumValidBytes; // <= BANK_SIZE
