- Timestamp:
- Aug 4, 2006 11:00:35 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/dsound.c
r637 r644 45 45 46 46 #define MAX_PACKET_BUFFER_COUNT 32 47 #define DEFAULT_BUFFER_COUNT 3247 #define DEFAULT_BUFFER_COUNT 16 48 48 49 49 #define MAX_HARDWARE 16 … … 453 453 unsigned eventCount; 454 454 unsigned bytes_per_frame; 455 int excess_rec = 0; 455 456 pj_status_t status; 456 457 … … 466 467 * system activity. 467 468 */ 468 SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_HIGHEST);469 //SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_HIGHEST); 469 470 470 471 /* Calculate bytes per frame */ … … 502 503 503 504 struct dsound_stream *dsound_strm; 505 int i; 504 506 505 507 /* … … 509 511 510 512 dsound_strm = &strm->play_strm; 511 512 /* Get frame from application. */ 513 status = (*strm->play_cb)(strm->user_data, 514 dsound_strm->timestamp.u32.lo, 515 strm->buffer, 513 status = PJ_SUCCESS; 514 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, 516 528 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 517 537 if (status != PJ_SUCCESS) 518 538 break; 519 520 /* Write to DirectSound buffer. */521 AppWriteDataToBuffer( dsound_strm->ds.play.lpDsBuffer,522 dsound_strm->dwBytePos,523 (LPBYTE)strm->buffer,524 bytes_per_frame);525 526 /* Increment position. */527 dsound_strm->dwBytePos += bytes_per_frame;528 if (dsound_strm->dwBytePos >= dsound_strm->dwDsBufferSize)529 dsound_strm->dwBytePos -= dsound_strm->dwDsBufferSize;530 dsound_strm->timestamp.u64 += strm->samples_per_frame;531 539 532 540 } else { … … 537 545 */ 538 546 struct dsound_stream *dsound_strm; 547 int captured = 0; 539 548 BOOL rc; 540 549 … … 550 559 if (!rc) { 551 560 pj_bzero(strm->buffer, bytes_per_frame); 561 } else { 562 captured++; 552 563 } 553 564 … … 571 582 /* Fetch while we have more than 1 frame */ 572 583 } while (dsound_captured_size(dsound_strm) > bytes_per_frame); 584 585 excess_rec = captured-1; 586 if (excess_rec < 0) excess_rec = 0; 573 587 } 574 588 }
Note: See TracChangeset
for help on using the changeset viewer.