Ignore:
Timestamp:
Aug 4, 2006 6:27:19 PM (18 years ago)
Author:
bennylp
Message:

More work on the AEC (including changes in PJSUA), embed the AEC in sound_port, reduce DirectSound? buffer from 32 to 16, and fixed ARM compilation for MSVC WinCE target.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/dsound.c

    r644 r648  
    453453    unsigned eventCount; 
    454454    unsigned bytes_per_frame; 
    455     int excess_rec = 0; 
    456455    pj_status_t status; 
    457456 
     
    503502             
    504503            struct dsound_stream *dsound_strm; 
    505             int i; 
    506504 
    507505            /* 
     
    513511            status = PJ_SUCCESS; 
    514512 
    515             for (i=0; i <= excess_rec; ++i) { 
    516                 /* Get frame from application. */ 
    517                 status = (*strm->play_cb)(strm->user_data,  
    518                                           dsound_strm->timestamp.u32.lo, 
    519                                           strm->buffer, 
    520                                           bytes_per_frame); 
    521                 if (status != PJ_SUCCESS) 
    522                     break; 
    523  
    524                 /* Write to DirectSound buffer. */ 
    525                 AppWriteDataToBuffer( dsound_strm->ds.play.lpDsBuffer,  
    526                                       dsound_strm->dwBytePos, 
    527                                       (LPBYTE)strm->buffer,  
     513            /* Get frame from application. */ 
     514            status = (*strm->play_cb)(strm->user_data,  
     515                                      dsound_strm->timestamp.u32.lo, 
     516                                      strm->buffer, 
    528517                                      bytes_per_frame); 
    529  
    530                 /* Increment position. */ 
    531                 dsound_strm->dwBytePos += bytes_per_frame; 
    532                 if (dsound_strm->dwBytePos >= dsound_strm->dwDsBufferSize) 
    533                     dsound_strm->dwBytePos -= dsound_strm->dwDsBufferSize; 
    534                 dsound_strm->timestamp.u64 += strm->samples_per_frame; 
    535             } 
    536  
    537518            if (status != PJ_SUCCESS) 
    538519                break; 
     520 
     521            /* Write to DirectSound buffer. */ 
     522            AppWriteDataToBuffer( dsound_strm->ds.play.lpDsBuffer,  
     523                                  dsound_strm->dwBytePos, 
     524                                  (LPBYTE)strm->buffer,  
     525                                  bytes_per_frame); 
     526 
     527            /* Increment position. */ 
     528            dsound_strm->dwBytePos += bytes_per_frame; 
     529            if (dsound_strm->dwBytePos >= dsound_strm->dwDsBufferSize) 
     530                dsound_strm->dwBytePos -= dsound_strm->dwDsBufferSize; 
     531            dsound_strm->timestamp.u64 += strm->samples_per_frame; 
    539532 
    540533        } else { 
     
    545538             */ 
    546539            struct dsound_stream *dsound_strm; 
    547             int captured = 0; 
    548540            BOOL rc; 
    549541 
     
    559551                if (!rc) { 
    560552                    pj_bzero(strm->buffer, bytes_per_frame); 
    561                 } else { 
    562                     captured++; 
    563                 } 
     553                }  
    564554 
    565555                /* Call callback */ 
     
    583573            } while (dsound_captured_size(dsound_strm) > bytes_per_frame); 
    584574 
    585             excess_rec = captured-1; 
    586             if (excess_rec < 0) excess_rec = 0; 
    587575        } 
    588576    } 
Note: See TracChangeset for help on using the changeset viewer.