Ver código fonte

cmProc4.c : cmRecdPlayExec() now checks for NULL inputs and outputs.

master
Kevin Larke 10 anos atrás
pai
commit
921891bbf1
1 arquivos alterados com 14 adições e 4 exclusões
  1. 14
    4
      cmProc4.c

+ 14
- 4
cmProc4.c Ver arquivo

@@ -4492,7 +4492,10 @@ cmRC_t         cmRecdPlayExec( cmRecdPlay* p, const cmSample_t** iChs, cmSample_
4492 4492
 
4493 4493
   // copy first block to end of LA buffer
4494 4494
   for(i=0; i<chCnt; ++i)
4495
-    cmVOS_Copy(p->laChs[i]+p->laSmpIdx,n0,iChs[i] + srcOffs);
4495
+    if( iChs[i] == NULL )
4496
+      cmVOS_Zero(p->laChs[i]+p->laSmpIdx,n0);
4497
+    else
4498
+      cmVOS_Copy(p->laChs[i]+p->laSmpIdx,n0,iChs[i] + srcOffs);
4496 4499
 
4497 4500
   p->laSmpIdx += n0;
4498 4501
 
@@ -4500,7 +4503,10 @@ cmRC_t         cmRecdPlayExec( cmRecdPlay* p, const cmSample_t** iChs, cmSample_
4500 4503
   {
4501 4504
     // copy second block to begin of LA buffer
4502 4505
     for(i=0; i<chCnt; ++i)
4503
-      cmVOS_Copy(p->laChs[i],n1,iChs[i] + srcOffs + n0);
4506
+      if( iChs[i] == NULL )
4507
+        cmVOS_Zero(p->laChs[i],n1);
4508
+      else
4509
+        cmVOS_Copy(p->laChs[i],n1,iChs[i] + srcOffs + n0);
4504 4510
 
4505 4511
     p->laSmpIdx = n1; 
4506 4512
 
@@ -4517,7 +4523,10 @@ cmRC_t         cmRecdPlayExec( cmRecdPlay* p, const cmSample_t** iChs, cmSample_
4517 4523
     unsigned n = cmMin(fp->allocCnt - fp->recdIdx,smpCnt);
4518 4524
     unsigned i;
4519 4525
     for(i=0; i<p->chCnt; ++i)
4520
-      cmVOS_Copy(fp->chArray[i] + fp->recdIdx, n, iChs[i] );
4526
+      if( iChs[i] == NULL )
4527
+        cmVOS_Zero(fp->chArray[i] + fp->recdIdx, n );
4528
+      else
4529
+        cmVOS_Copy(fp->chArray[i] + fp->recdIdx, n, iChs[i] );
4521 4530
 
4522 4531
     fp->recdIdx += n;
4523 4532
 
@@ -4536,7 +4545,8 @@ cmRC_t         cmRecdPlayExec( cmRecdPlay* p, const cmSample_t** iChs, cmSample_
4536 4545
     unsigned i;
4537 4546
 
4538 4547
     for(i=0; i<p->chCnt; ++i)
4539
-      cmVOS_MultVVS(oChs[i],n,fp->chArray[i] + fp->playIdx,gain);
4548
+      if( oChs[i] != NULL )
4549
+        cmVOS_MultVVS(oChs[i],n,fp->chArray[i] + fp->playIdx,gain);
4540 4550
 
4541 4551
     fp->playIdx += n;
4542 4552
 

Carregando…
Cancelar
Salvar