Changeset 369


Ignore:
Timestamp:
Sep 3, 2008, 4:08:49 PM (17 years ago)
Author:
rjerant
Message:

Fixed ticket:18 - streaming problem with video playback

Location:
OCO/trunk/drv16
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OCO/trunk/drv16/waudio.cpp

    r330 r369  
    12871287#pragma on (unreferenced)
    12881288{
     1289         ULONG  ulBytesPerIRQ;
     1290         
    12891291#ifdef DEBUG
    12901292    dprintf(("WAVEAUDIO::ConfigDev"));
     
    13211323    } /* endswitch */
    13221324
    1323     // Calculate the PCMConsumeRate
     1325          // Calculate the BytesPerIRQ
     1326          // The BytesPerIRQ is the number of bytes consumed by this data format
     1327          // for every interrupt generated by the codec.
     1328          // This information is returned to the WAVESTREAM which uses it in
     1329          // buffer management decisions....
     1330          // rjj Fix for Bug #18 28082008
     1331         
     1332          ulBytesPerIRQ = pConfigInfo->ulSampleRate;
     1333          ulBytesPerIRQ >>= 5; // 32 interrupts per second
     1334                               // we can tweak this as needed but generally this should do rjj
     1335         
     1336          if (pConfigInfo->ulBitsPerSample == 16) {
     1337                ulBytesPerIRQ <<= 1;
     1338          }
     1339          if (pConfigInfo->ulNumChannels == 2) {
     1340                ulBytesPerIRQ <<= 1;
     1341          }
     1342          // make sure it's an even multiple of 64
     1343          ulBytesPerIRQ += 0x00000040;
     1344          ulBytesPerIRQ &= 0xFFFFFFC0;
     1345               
     1346          if (ulBytesPerIRQ > 0x800) {
     1347                ulBytesPerIRQ = 0x800;
     1348          }
     1349          pConfigInfo->ulBytesPerIRQ = ulBytesPerIRQ;
     1350
     1351          // Calculate the PCMConsumeRate
    13241352    // The consume rate is the number of bytes consumed by this data format
    13251353    // per second. It calculated by taking the following equation:
  • OCO/trunk/drv16/waudio.hpp

    r221 r369  
    7676   ULONG  ulDataType;        // type of data (PCM, MuLaw, ALaw etc) Input
    7777   ULONG  ulPCMConsumeRate;  // number of bytes consumed/produced per sec Output
     78         ULONG  ulBytesPerIRQ;     // The number of bytes consumed per irq rjj Fix for Bug #18 28082008
    7879
    7980   ULONG  ulFragsize;
  • OCO/trunk/drv16/wavestrm.cpp

    r288 r369  
    299299    case STREAM_WRITE:
    300300    {
    301         if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE ||
     301        if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE || 
    302302           ulCurBytesProcessed == 0)
    303303        {//shouldn't happen
     
    318318
    319319            ulStreamPos  = pahw->ConvertPositionInvert(ulCurBytesProcessed, &_configinfo);
    320              //round to sample boundary
     320            //round to sample boundary
    321321            ulStreamPos &= ~(_configinfo.ulSampleSize - 1);
    322322
    323323#ifdef DEBUG
    324               dprintf(("WARNING: Process: Current pos %ld pos %ld incr %d", ulCurBytesProcessed, _ulBytesProcessed, bytesinc));
    325               dprintf(("WARNING: hw pos %lx, streampos %lx", ulCurBytesProcessed, ulStreamPos));
     324            dprintf(("WARNING: Process: Current pos %ld pos %ld incr %d", ulCurBytesProcessed, _ulBytesProcessed, bytesinc));
     325            dprintf(("WARNING: hw pos %lx, streampos %lx", ulCurBytesProcessed, ulStreamPos));
    326326#endif /* DEBUG */
    327327        }
     
    330330        while(bytesinc)
    331331        {
    332             if(qhDone.IsElements()) {  // if there are buffers that have been
    333                                        // completly written to the audio buffer
     332          if(qhDone.IsElements()) {  // if there are buffers that have been completly written to the audio buffer
    334333                                       // check the first one on the done queue
    335                                        // if it's data has been consumed by
    336                                        // the hardware return it
     334                                       // if it's data has been consumed by the hardware return it.
     335                                                         // Bug #18 Sometimes MMPM gives us really small buffers. If we
     336                                                         // wait for the buffer to be completly consumed and there is a tiny buffer
     337                                                         // on the queue after this one, the sound part could underrun before we get a
     338                                                         // chance to refill it. To fix this we will return the buffer if it will be 
     339                                                         // consumed before the next call to WAVESTREAM:Process().
     340                                                         // rjj Fix for Bug #18 28082008
    337341                ptemp = (PSTREAMBUFFER)qhDone.Head();
    338342                ptemp->ulDonepos += bytesinc;
    339343                bytesinc          = 0;
    340                 if(ptemp->ulDonepos >= ptemp->ulBuffsz)
     344                                  if ((ptemp->ulDonepos + _configinfo.ulBytesPerIRQ) >= ptemp->ulBuffsz)
    341345                {
    342346                    //calc position in next buffer
    343347                    bytesinc = ptemp->ulDonepos - ptemp->ulBuffsz;
    344 //                    dprintf2(("Process: Return buffer %lx size %d", ptemp->pBuffptr, ptemp->ulBuffsz));
     348//                  dprintf2(("Process: Return buffer %lx size %d", ptemp->pBuffptr, ptemp->ulBuffsz));
    345349                    ReturnBuffer();
    346                         }
    347             }
     350                          }
     351          }
    348352            else        break; //shouldn't happen
    349353        }
Note: See TracChangeset for help on using the changeset viewer.