Changeset 94957 in vbox
- Timestamp:
- May 9, 2022 2:05:43 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DrvAudioRec.cpp
r94326 r94957 328 328 const settings::RecordingScreenSettings &Screen0Settings = mVideoRecCfg.mapScreens[0]; 329 329 330 int rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "ContainerType", (uint64_t)Screen0Settings.enmDest);331 AssertRCReturn( rc,rc);330 int vrc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "ContainerType", (uint64_t)Screen0Settings.enmDest); 331 AssertRCReturn(vrc, vrc); 332 332 if (Screen0Settings.enmDest == RecordingDestination_File) 333 333 { 334 rc = pVMM->pfnCFGMR3InsertString(pLunCfg, "ContainerFileName", Utf8Str(Screen0Settings.File.strName).c_str());335 AssertRCReturn( rc,rc);336 } 337 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecHz", Screen0Settings.Audio.uHz);338 AssertRCReturn( rc,rc);339 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecBits", Screen0Settings.Audio.cBits);340 AssertRCReturn( rc,rc);341 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecChannels", Screen0Settings.Audio.cChannels);342 AssertRCReturn( rc,rc);343 rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecBitrate", 0); /* Let Opus decide for now. */344 AssertRCReturn( rc,rc);334 vrc = pVMM->pfnCFGMR3InsertString(pLunCfg, "ContainerFileName", Utf8Str(Screen0Settings.File.strName).c_str()); 335 AssertRCReturn(vrc, vrc); 336 } 337 vrc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecHz", Screen0Settings.Audio.uHz); 338 AssertRCReturn(vrc, vrc); 339 vrc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecBits", Screen0Settings.Audio.cBits); 340 AssertRCReturn(vrc, vrc); 341 vrc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecChannels", Screen0Settings.Audio.cChannels); 342 AssertRCReturn(vrc, vrc); 343 vrc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "CodecBitrate", 0); /* Let Opus decide for now. */ 344 AssertRCReturn(vrc, vrc); 345 345 346 346 return AudioDriver::configureDriver(pLunCfg, pVMM); … … 410 410 411 411 #ifdef VBOX_WITH_LIBOPUS 412 int rc = RTCircBufCreate(&pStreamAV->pCircBuf, pSink->Codec.Opus.cbFrame * 2 /* Use "double buffering" */);413 if (RT_SUCCESS( rc))412 int vrc = RTCircBufCreate(&pStreamAV->pCircBuf, pSink->Codec.Opus.cbFrame * 2 /* Use "double buffering" */); 413 if (RT_SUCCESS(vrc)) 414 414 { 415 415 size_t cbScratchBuf = pSink->Codec.Opus.cbFrame; … … 438 438 } 439 439 else 440 rc = VERR_NO_MEMORY;440 vrc = VERR_NO_MEMORY; 441 441 } 442 442 else 443 rc = VERR_NO_MEMORY;443 vrc = VERR_NO_MEMORY; 444 444 } 445 445 #else 446 446 RT_NOREF(pThis, pSink, pStreamAV, pCfgReq, pCfgAcq); 447 int rc = VERR_NOT_SUPPORTED;447 int vrc = VERR_NOT_SUPPORTED; 448 448 #endif /* VBOX_WITH_LIBOPUS */ 449 449 450 LogFlowFuncLeaveRC( rc);451 return rc;450 LogFlowFuncLeaveRC(vrc); 451 return vrc; 452 452 } 453 453 … … 472 472 PAVRECSINK pSink = &pThis->Sink; 473 473 474 int rc = avRecCreateStreamOut(pThis, pStreamAV, pSink, pCfgReq, pCfgAcq);474 int vrc = avRecCreateStreamOut(pThis, pStreamAV, pSink, pCfgReq, pCfgAcq); 475 475 PDMAudioStrmCfgCopy(&pStreamAV->Cfg, pCfgAcq); 476 476 477 return rc;477 return vrc; 478 478 } 479 479 … … 527 527 RT_NOREF(fImmediate); 528 528 529 int rc = VINF_SUCCESS;529 int vrc = VINF_SUCCESS; 530 530 if (pStreamAV->Cfg.enmDir == PDMAUDIODIR_OUT) 531 rc = avRecDestroyStreamOut(pThis, pStreamAV);532 533 return rc;531 vrc = avRecDestroyStreamOut(pThis, pStreamAV); 532 533 return vrc; 534 534 } 535 535 … … 620 620 AssertReturn(pcbWritten, VERR_INVALID_PARAMETER); 621 621 622 int rc = VINF_SUCCESS;622 int vrc = VINF_SUCCESS; 623 623 624 624 uint32_t cbWrittenTotal = 0; … … 736 736 case AVRECCONTAINERTYPE_MAIN_CONSOLE: 737 737 { 738 HRESULT hr = pSink->Con.Main.pConsole->i_recordingSendAudio(pStreamAV->pvDstBuf, cbDst, uPTSMs);739 Assert(hr == S_OK);740 RT_NOREF(hr );738 HRESULT hrc = pSink->Con.Main.pConsole->i_recordingSendAudio(pStreamAV->pvDstBuf, cbDst, uPTSMs); 739 Assert(hrc == S_OK); 740 RT_NOREF(hrc); 741 741 break; 742 742 } … … 745 745 { 746 746 WebMWriter::BlockData_Opus blockData = { pStreamAV->pvDstBuf, cbDst, uPTSMs }; 747 rc = pSink->Con.WebM.pWebM->WriteBlock(pSink->Con.WebM.uTrack, &blockData, sizeof(blockData));748 AssertRC( rc);747 vrc = pSink->Con.WebM.pWebM->WriteBlock(pSink->Con.WebM.uTrack, &blockData, sizeof(blockData)); 748 AssertRC(vrc); 749 749 break; 750 750 } 751 751 752 752 default: 753 AssertFailedStmt( rc = VERR_NOT_IMPLEMENTED);753 AssertFailedStmt(vrc = VERR_NOT_IMPLEMENTED); 754 754 break; 755 755 } … … 758 758 { 759 759 AssertMsgFailed(("Encoding failed: %s\n", opus_strerror(cbWritten))); 760 rc = VERR_INVALID_PARAMETER;760 vrc = VERR_INVALID_PARAMETER; 761 761 } 762 762 763 if (RT_FAILURE( rc))763 if (RT_FAILURE(vrc)) 764 764 break; 765 765 } … … 770 770 *pcbWritten = cbBuf; 771 771 772 rc = VERR_NOT_SUPPORTED;772 vrc = VERR_NOT_SUPPORTED; 773 773 #endif /* VBOX_WITH_LIBOPUS */ 774 774 775 LogFlowFunc(("csReadTotal=%RU32, rc=%Rrc\n", cbWrittenTotal,rc));776 return rc;775 LogFlowFunc(("csReadTotal=%RU32, vrc=%Rrc\n", cbWrittenTotal, vrc)); 776 return vrc; 777 777 } 778 778 … … 848 848 pSink->Con.WebM.pWebM->GetFileName().c_str(), pSink->Con.WebM.pWebM->GetFileSize())); 849 849 850 int rc2 = pSink->Con.WebM.pWebM->Close();851 AssertRC( rc2);850 int vrc2 = pSink->Con.WebM.pWebM->Close(); 851 AssertRC(vrc2); 852 852 853 853 delete pSink->Con.WebM.pWebM; … … 977 977 } 978 978 979 int rc = VINF_SUCCESS;979 int vrc = VINF_SUCCESS; 980 980 981 981 try … … 990 990 } 991 991 else 992 rc = VERR_NOT_SUPPORTED;992 vrc = VERR_NOT_SUPPORTED; 993 993 break; 994 994 } … … 1004 1004 1005 1005 pSink->Con.WebM.pWebM = new WebMWriter(); 1006 rc = pSink->Con.WebM.pWebM->Open(pszFile,1007 /** @todo Add option to add some suffix if file exists instead of overwriting? */1008 RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE,1009 WebMWriter::AudioCodec_Opus, WebMWriter::VideoCodec_None);1010 if (RT_SUCCESS( rc))1006 vrc = pSink->Con.WebM.pWebM->Open(pszFile, 1007 /** @todo Add option to add some suffix if file exists instead of overwriting? */ 1008 RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE, 1009 WebMWriter::AudioCodec_Opus, WebMWriter::VideoCodec_None); 1010 if (RT_SUCCESS(vrc)) 1011 1011 { 1012 rc = pSink->Con.WebM.pWebM->AddAudioTrack(uHz, cChannels, cbSample * 8 /* Bits */,1013 &pSink->Con.WebM.uTrack);1014 if (RT_SUCCESS( rc))1012 vrc = pSink->Con.WebM.pWebM->AddAudioTrack(uHz, cChannels, cbSample * 8 /* Bits */, 1013 &pSink->Con.WebM.uTrack); 1014 if (RT_SUCCESS(vrc)) 1015 1015 { 1016 1016 LogRel(("Recording: Recording audio to audio file '%s'\n", pszFile)); 1017 1017 } 1018 1018 else 1019 LogRel(("Recording: Error creating audio track for audio file '%s' (%Rrc)\n", pszFile, rc));1019 LogRel(("Recording: Error creating audio track for audio file '%s' (%Rrc)\n", pszFile, vrc)); 1020 1020 } 1021 1021 else 1022 LogRel(("Recording: Error creating audio file '%s' (%Rrc)\n", pszFile, rc));1022 LogRel(("Recording: Error creating audio file '%s' (%Rrc)\n", pszFile, vrc)); 1023 1023 } 1024 1024 break; … … 1026 1026 1027 1027 default: 1028 rc = VERR_NOT_SUPPORTED;1028 vrc = VERR_NOT_SUPPORTED; 1029 1029 break; 1030 1030 } … … 1032 1032 catch (std::bad_alloc &) 1033 1033 { 1034 rc = VERR_NO_MEMORY;1035 } 1036 1037 if (RT_SUCCESS( rc))1034 vrc = VERR_NO_MEMORY; 1035 } 1036 1037 if (RT_SUCCESS(vrc)) 1038 1038 { 1039 1039 pSink->Con.Parms.enmType = pConParms->enmType; … … 1066 1066 } 1067 1067 1068 LogRel(("Recording: Error creating sink (%Rrc)\n", rc));1069 } 1070 1071 return rc;1068 LogRel(("Recording: Error creating sink (%Rrc)\n", vrc)); 1069 } 1070 1071 return vrc; 1072 1072 } 1073 1073 … … 1152 1152 RT_ZERO(pThis->CodecParms); 1153 1153 1154 int rc = pHlp->pfnCFGMQueryU32(pCfg, "ContainerType", (uint32_t *)&pConParams->enmType);1155 AssertRCReturn( rc,rc);1154 int vrc = pHlp->pfnCFGMQueryU32(pCfg, "ContainerType", (uint32_t *)&pConParams->enmType); 1155 AssertRCReturn(vrc, vrc); 1156 1156 1157 1157 switch (pConParams->enmType) 1158 1158 { 1159 1159 case AVRECCONTAINERTYPE_WEBM: 1160 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "ContainerFileName", &pConParams->WebM.pszFile);1161 AssertRCReturn( rc,rc);1160 vrc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "ContainerFileName", &pConParams->WebM.pszFile); 1161 AssertRCReturn(vrc, vrc); 1162 1162 break; 1163 1163 … … 1167 1167 1168 1168 uint32_t uHz = 0; 1169 rc = pHlp->pfnCFGMQueryU32(pCfg, "CodecHz", &uHz);1170 AssertRCReturn( rc,rc);1169 vrc = pHlp->pfnCFGMQueryU32(pCfg, "CodecHz", &uHz); 1170 AssertRCReturn(vrc, vrc); 1171 1171 1172 1172 uint8_t cSampleBits = 0; 1173 rc = pHlp->pfnCFGMQueryU8(pCfg, "CodecBits", &cSampleBits); /** @todo CodecBits != CodecBytes */1174 AssertRCReturn( rc,rc);1173 vrc = pHlp->pfnCFGMQueryU8(pCfg, "CodecBits", &cSampleBits); /** @todo CodecBits != CodecBytes */ 1174 AssertRCReturn(vrc, vrc); 1175 1175 1176 1176 uint8_t cChannels = 0; 1177 rc = pHlp->pfnCFGMQueryU8(pCfg, "CodecChannels", &cChannels);1178 AssertRCReturn( rc,rc);1177 vrc = pHlp->pfnCFGMQueryU8(pCfg, "CodecChannels", &cChannels); 1178 AssertRCReturn(vrc, vrc); 1179 1179 1180 1180 PDMAudioPropsInit(&pCodecParms->PCMProps, cSampleBits / 8, true /*fSigned*/, cChannels, uHz); … … 1182 1182 ("Configuration error: Audio configuration is invalid!\n"), VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES); /** @todo wrong status code. */ 1183 1183 1184 rc = pHlp->pfnCFGMQueryU32(pCfg, "CodecBitrate", &pCodecParms->uBitrate);1185 AssertRCReturn( rc,rc);1184 vrc = pHlp->pfnCFGMQueryU32(pCfg, "CodecBitrate", &pCodecParms->uBitrate); 1185 AssertRCReturn(vrc, vrc); 1186 1186 1187 1187 /* … … 1206 1206 PDMAudioPropsChannels(&pThis->CodecParms.PCMProps), PDMAudioPropsChannels(&pThis->CodecParms.PCMProps) == 1 ? "" : "s")); 1207 1207 1208 rc = avRecSinkInit(pThis, &pThis->Sink, &pThis->ContainerParms, &pThis->CodecParms);1209 if (RT_SUCCESS( rc))1208 vrc = avRecSinkInit(pThis, &pThis->Sink, &pThis->ContainerParms, &pThis->CodecParms); 1209 if (RT_SUCCESS(vrc)) 1210 1210 LogRel2(("Recording: Audio recording driver initialized\n")); 1211 1211 else 1212 LogRel(("Recording: Audio recording driver initialization failed: %Rrc\n", rc));1213 1214 return rc;1212 LogRel(("Recording: Audio recording driver initialization failed: %Rrc\n", vrc)); 1213 1214 return vrc; 1215 1215 } 1216 1216
Note:
See TracChangeset
for help on using the changeset viewer.