Changeset 89992 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jul 2, 2021 8:56:55 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp
r89962 r89992 719 719 const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten) 720 720 { 721 RT_NOREF(pStream);722 723 721 if (cbBuf == 0) 724 722 { … … 730 728 PDRVHOSTVALKITAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTVALKITAUDIO, IHostAudio); 731 729 732 PVALKITTESTDATA pTst = NULL;730 bool const fIsSilence = PDMAudioPropsIsBufferSilence(&pStream->pStream->Cfg.Props, pvBuf, cbBuf); 733 731 734 732 int rc = RTCritSectEnter(&pThis->CritSect); … … 736 734 { 737 735 if (pThis->pTestCur == NULL) 736 { 738 737 pThis->pTestCur = RTListGetFirst(&pThis->lstTestsPlay, VALKITTESTDATA, Node); 739 740 pTst = pThis->pTestCur; 738 if (pThis->pTestCur) 739 LogRel(("ValKit: Next guest playback test in queue is test #%RU32\n", pThis->pTestCur->idxTest)); 740 } 741 741 742 742 int rc2 = RTCritSectLeave(&pThis->CritSect); … … 744 744 } 745 745 746 if (pTst == NULL) /* Empty list? */ 747 { 748 LogRel(("ValKit: Warning: Guest is playing back data when no playback test is active\n")); 746 if (pThis->pTestCur == NULL) /* Empty list? */ 747 { 748 #ifdef DEBUG_andy 749 if (!fIsSilence) 750 #endif 751 LogRel(("ValKit: Warning: Guest is playing back audio (%s, %RU32 bytes, %RU64ms) when no playback test is active\n", 752 fIsSilence ? "silence" : "audible", cbBuf, PDMAudioPropsBytesToMilli(&pStream->pStream->Cfg.Props, cbBuf))); 749 753 750 754 *pcbWritten = cbBuf; … … 752 756 } 753 757 754 #if 1 755 if (PDMAudioPropsIsBufferSilence(&pStream->pStream->Cfg.Props, pvBuf, cbBuf)) 756 { 757 LogRel(("ValKit: Skipping %RU32 bytes of silence\n", cbBuf)); 758 759 *pcbWritten = cbBuf; 760 return VINF_SUCCESS; 761 } 758 #ifndef DEBUG_andy 759 if (fIsSilence) 760 LogRel2(("ValKit: Guest is playing back %RU32 bytes (%RU64ms) silence\n", 761 cbBuf, PDMAudioPropsBytesToMilli(&pStream->pStream->Cfg.Props, cbBuf))); 762 762 #endif 763 763 764 if (pTst->t.TestTone.u.Play.cbRead == 0) 764 PVALKITTESTDATA pTst = pThis->pTestCur; 765 766 const bool fHandleSilence = false; /** @todo Skip blocks of entire silence for now. */ 767 768 if (pTst->pEntry == NULL) 765 769 { 766 770 AUDIOTESTPARMS Parms; … … 770 774 Parms.TestTone = pTst->t.TestTone.Parms; 771 775 772 Assert(pTst->pEntry == NULL);773 776 rc = AudioTestSetTestBegin(&pThis->Set, "Recording audio data from guest", 774 777 &Parms, &pTst->pEntry); … … 788 791 if (RT_SUCCESS(rc)) 789 792 { 790 rc = AudioTestSetObjWrite(pTst->pObj, pvBuf, cbBuf); 791 if (RT_SUCCESS(rc)) 792 { 793 if ( !fIsSilence 794 || (fIsSilence && fHandleSilence)) 795 { 796 rc = AudioTestSetObjWrite(pTst->pObj, pvBuf, cbBuf); 793 797 pTst->t.TestTone.u.Play.cbRead += cbBuf; 794 798 795 #if 0796 799 const bool fComplete = pTst->t.TestTone.u.Play.cbRead >= pTst->t.TestTone.u.Play.cbToRead; 797 800 if (fComplete) … … 804 807 pTst->idxTest, pTst->t.TestTone.u.Play.cbRead - pTst->t.TestTone.u.Play.cbToRead)); 805 808 809 AudioTestSetTestDone(pTst->pEntry); 810 806 811 rc = RTCritSectEnter(&pThis->CritSect); 807 812 if (RT_SUCCESS(rc)) 808 813 { 809 AudioTestSetTestDone(pTst->pEntry);814 drvHostValKiUnregisterPlayTest(pThis, pTst); 810 815 811 816 pThis->pTestCur = NULL; 812 817 pTst = NULL; 813 814 if (pThis->fTestSetEnded)815 rc = RTSemEventSignal(pThis->EventSemEnded);816 818 817 819 int rc2 = RTCritSectLeave(&pThis->CritSect); … … 820 822 } 821 823 } 822 #endif823 824 cbWritten = cbBuf;825 }824 } 825 826 /* Always report everything as being played. */ 827 cbWritten = cbBuf; 826 828 } 827 829 … … 848 850 RT_NOREF(pStream); 849 851 852 if (cbBuf == 0) 853 { 854 /* Fend off draining calls. */ 855 *pcbRead = 0; 856 return VINF_SUCCESS; 857 } 858 850 859 PDRVHOSTVALKITAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTVALKITAUDIO, IHostAudio); 851 860 … … 854 863 { 855 864 if (pThis->pTestCur == NULL) 865 { 856 866 pThis->pTestCur = RTListGetFirst(&pThis->lstTestsRec, VALKITTESTDATA, Node); 867 if (pThis->pTestCur) 868 LogRel(("ValKit: Next guest recording test in queue is test #%RU32\n", pThis->pTestCur->idxTest)); 869 } 857 870 858 871 int rc2 = RTCritSectLeave(&pThis->CritSect); … … 862 875 if (pThis->pTestCur == NULL) /* Empty list? */ 863 876 { 864 LogRelMax(64, ("ValKit: Warning: Guest is recordingaudio data when no recording test is active\n"));877 LogRelMax(64, ("ValKit: Warning: Guest is trying to record audio data when no recording test is active\n")); 865 878 866 879 *pcbRead = 0; … … 870 883 PVALKITTESTDATA pTst = pThis->pTestCur; 871 884 872 if (pTst-> t.TestTone.u.Rec.cbWritten == 0)885 if (pTst->pEntry == NULL) 873 886 { 874 887 AUDIOTESTPARMS Parms; … … 878 891 Parms.TestTone = pTst->t.TestTone.Parms; 879 892 880 Assert(pTst->pEntry == NULL);881 893 rc = AudioTestSetTestBegin(&pThis->Set, "Injecting audio input data to guest", 882 894 &Parms, &pTst->pEntry); … … 909 921 Assert(pTst->t.TestTone.u.Rec.cbWritten <= pTst->t.TestTone.u.Rec.cbToWrite); 910 922 911 const bool fComplete = pTst->t.TestTone.u.Rec.cbToWrite == pTst->t.TestTone.u.Rec.cbWritten; 912 923 const bool fComplete = pTst->t.TestTone.u.Rec.cbToWrite >= pTst->t.TestTone.u.Rec.cbWritten; 913 924 if (fComplete) 914 925 { 915 926 LogRel(("ValKit: Injecting audio input data done (took %RU32ms)\n", 916 927 RTTimeMilliTS() - pTst->msStartedTS)); 928 929 AudioTestSetTestDone(pTst->pEntry); 917 930 918 931 rc = RTCritSectEnter(&pThis->CritSect);
Note:
See TracChangeset
for help on using the changeset viewer.