Changeset 74850 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Oct 15, 2018 4:45:58 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp
r74849 r74850 5 5 6 6 /* 7 * Copyright (C) 2016-201 7Oracle Corporation7 * Copyright (C) 2016-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 171 171 typedef struct AVRECCODECPARMS 172 172 { 173 /** The encoding rate to use. */ 174 uint32_t uHz; 175 /** Number of audio channels to encode. 176 * Currently we only supported stereo (2) channels. */ 177 uint8_t cChannels; 178 /** Bits per sample. */ 179 uint8_t cBits; 173 /** The codec's used PCM properties. */ 174 PDMAUDIOPCMPROPS PCMProps; 180 175 /** The codec's bitrate. 0 if not used / cannot be specified. */ 181 176 uint32_t uBitrate; … … 286 281 static int avRecSinkInit(PDRVAUDIOVIDEOREC pThis, PAVRECSINK pSink, PAVRECCONTAINERPARMS pConParms, PAVRECCODECPARMS pCodecParms) 287 282 { 288 uint32_t uHz = pCodecParms-> uHz;289 uint8_t cB its = pCodecParms->cBits;290 uint8_t cChannels = pCodecParms-> cChannels;283 uint32_t uHz = pCodecParms->PCMProps.uHz; 284 uint8_t cBytes = pCodecParms->PCMProps.cBytes; 285 uint8_t cChannels = pCodecParms->PCMProps.cChannels; 291 286 uint32_t uBitrate = pCodecParms->uBitrate; 292 287 … … 418 413 pSink->Con.Parms.enmType = pConParms->enmType; 419 414 420 pSink->Codec.Parms.uHz = uHz; 421 pSink->Codec.Parms.cChannels = cChannels; 422 pSink->Codec.Parms.cBits = cBits; 423 pSink->Codec.Parms.uBitrate = uBitrate; 415 pSink->Codec.Parms.PCMProps.uHz = uHz; 416 pSink->Codec.Parms.PCMProps.cChannels = cChannels; 417 pSink->Codec.Parms.PCMProps.cBytes = cBytes; 418 pSink->Codec.Parms.PCMProps.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pSink->Codec.Parms.PCMProps.cBytes, 419 pSink->Codec.Parms.PCMProps.cChannels); 420 pSink->Codec.Parms.uBitrate = uBitrate; 424 421 425 422 pSink->Codec.Opus.pEnc = pEnc; … … 522 519 const unsigned cFrames = 2; /** @todo Use the PreRoll param for that? */ 523 520 524 const uint32_t csFrame = pSink->Codec.Parms. uHz / (1000 /* s in ms */ / pSink->Codec.Opus.msFrame);525 const uint32_t cbFrame = csFrame * pSink->Codec.Parms.cChannels * (pSink->Codec.Parms.cBits / 8 /* Bytes */);521 const uint32_t csFrame = pSink->Codec.Parms.PCMProps.uHz / (1000 /* s in ms */ / pSink->Codec.Opus.msFrame); 522 const uint32_t cbFrame = DrvAudioHlpFramesToBytes(csFrame, &pSink->Codec.Parms.PCMProps); 526 523 527 524 rc = RTCircBufCreate(&pStreamAV->pCircBuf, cbFrame * cFrames); … … 535 532 /* Make sure to let the driver backend know that we need the audio data in 536 533 * a specific sampling rate Opus is optimized for. */ 537 pCfgAcq->Props.uHz = pSink->Codec.Parms. uHz;534 pCfgAcq->Props.uHz = pSink->Codec.Parms.PCMProps.uHz; 538 535 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels); 539 536 … … 622 619 623 620 AVRECCODECPARMS CodecParms; 624 CodecParms.uHz = AVREC_OPUS_HZ_MAX; /** @todo Make this configurable. */ 625 CodecParms.cChannels = 2; /** @todo Make this configurable. */ 626 CodecParms.cBits = 16; /** @todo Make this configurable. */ 627 CodecParms.uBitrate = 0; /* Let Opus decide, based on the number of channels and the input sampling rate. */ 621 CodecParms.PCMProps.uHz = AVREC_OPUS_HZ_MAX; /** @todo Make this configurable. */ 622 CodecParms.PCMProps.cChannels = 2; /** @todo Make this configurable. */ 623 CodecParms.PCMProps.cBytes = 2; /** 16 bit @todo Make this configurable. */ 624 625 CodecParms.uBitrate = 0; /* Let Opus decide, based on the number of channels and the input sampling rate. */ 628 626 629 627 int rc = avRecSinkInit(pThis, &pThis->Sink, &ContainerParms, &CodecParms); … … 720 718 size_t cbSrc; 721 719 722 const uint32_t csFrame = pSink->Codec.Parms. uHz / (1000 /* s in ms */ / pSink->Codec.Opus.msFrame);723 const uint32_t cbFrame = csFrame * pSink->Codec.Parms.cChannels * (pSink->Codec.Parms.cBits / 8 /* Bytes */);720 const uint32_t csFrame = pSink->Codec.Parms.PCMProps.uHz / (1000 /* s in ms */ / pSink->Codec.Opus.msFrame); 721 const uint32_t cbFrame = DrvAudioHlpFramesToBytes(csFrame, &pSink->Codec.Parms.PCMProps); 724 722 725 723 /* Only encode data if we have data for the given time period (or more). */
Note:
See TracChangeset
for help on using the changeset viewer.