Changeset 648 for pjproject/trunk/pjmedia/src/pjmedia/dsound.c
- Timestamp:
- Aug 4, 2006 6:27:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/dsound.c
r644 r648 453 453 unsigned eventCount; 454 454 unsigned bytes_per_frame; 455 int excess_rec = 0;456 455 pj_status_t status; 457 456 … … 503 502 504 503 struct dsound_stream *dsound_strm; 505 int i;506 504 507 505 /* … … 513 511 status = PJ_SUCCESS; 514 512 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, 528 517 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 537 518 if (status != PJ_SUCCESS) 538 519 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; 539 532 540 533 } else { … … 545 538 */ 546 539 struct dsound_stream *dsound_strm; 547 int captured = 0;548 540 BOOL rc; 549 541 … … 559 551 if (!rc) { 560 552 pj_bzero(strm->buffer, bytes_per_frame); 561 } else { 562 captured++; 563 } 553 } 564 554 565 555 /* Call callback */ … … 583 573 } while (dsound_captured_size(dsound_strm) > bytes_per_frame); 584 574 585 excess_rec = captured-1;586 if (excess_rec < 0) excess_rec = 0;587 575 } 588 576 }
Note: See TracChangeset
for help on using the changeset viewer.