VirtualBox

Changeset 71733 in vbox


Ignore:
Timestamp:
Apr 7, 2018 2:35:47 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121835
Message:

HDAStreamPeriod.cpp: No point in hdaStreamPeriodCreate returning VINF_SUCCESS even when RTCritSectInit fails (if that is intentional, please change it to a void function). The HDASTREAMPERIOD::Dbg.tsStartNs member is used in log statements but was incorrectly guarded by DEBUG rather than LOG_ENABLED (this would create build problems if enabling logging in say a release build).

Location:
trunk/src/VBox/Devices/Audio
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/HDAStream.h

    r70964 r71733  
    2424#include "HDAStreamPeriod.h"
    2525
    26 /*********************************************************************************************************************************
    27 *   Prototypes                                                                                                                   *
    28 *********************************************************************************************************************************/
    2926
    3027typedef struct HDAMIXERSINK *PHDAMIXERSINK;
  • trunk/src/VBox/Devices/Audio/HDAStreamPeriod.cpp

    r71711 r71733  
    33 * HDAStreamPeriod.cpp - Stream period functions for HD Audio.
    44 *
    5  * Utility functions for handling HDA audio stream periods.
    6  * Stream period handling is needed in order to keep track of a stream's timing
     5 * Utility functions for handling HDA audio stream periods.  Stream period
     6 * handling is needed in order to keep track of a stream's timing
    77 * and processed audio data.
    88 *
    9  * As the HDA device only has one bit clock (WALCLK) but audio streams can be processed
    10  * at certain points in time, these functions can be used to estimate and schedule the
    11  * wall clock (WALCLK) for all streams accordingly.
     9 * As the HDA device only has one bit clock (WALCLK) but audio streams can be
     10 * processed at certain points in time, these functions can be used to estimate
     11 * and schedule the wall clock (WALCLK) for all streams accordingly.
    1212 */
    1313
     
    3939#include "HDAStreamPeriod.h"
    4040
    41 #ifdef IN_RING3
     41
     42#ifdef IN_RING3 /* entire file currently */
     43
    4244/**
    4345 * Creates a stream period.
     
    5153
    5254    int rc = RTCritSectInit(&pPeriod->CritSect);
    53     if (RT_SUCCESS(rc))
    54     {
    55         pPeriod->fStatus = HDASTREAMPERIOD_FLAG_VALID;
    56     }
     55    AssertRCReturnStmt(rc, pPeriod->fStatus = 0, rc);
     56    pPeriod->fStatus = HDASTREAMPERIOD_FLAG_VALID;
    5757
    5858    return VINF_SUCCESS;
     
    143143    pPeriod->framesTransferred = 0;
    144144    pPeriod->cIntPending       = 0;
    145 #ifdef DEBUG
     145# ifdef LOG_ENABLED
    146146    pPeriod->Dbg.tsStartNs     = 0;
    147 #endif
     147# endif
    148148}
    149149
     
    164164    pPeriod->framesTransferred = 0;
    165165    pPeriod->cIntPending       = 0;
    166 #ifdef DEBUG
     166# ifdef LOG_ENABLED
    167167    pPeriod->Dbg.tsStartNs     = RTTimeNanoTS();
    168 #endif
    169 
    170     Log3Func(("[SD%RU8] Starting @ %RU64 (%RU64 long)\n",
    171               pPeriod->u8SD, pPeriod->u64StartWalClk, pPeriod->u64DurationWalClk));
    172 
     168# endif
     169
     170    Log3Func(("[SD%RU8] Starting @ %RU64 (%RU64 long)\n", pPeriod->u8SD, pPeriod->u64StartWalClk, pPeriod->u64DurationWalClk));
    173171    return VINF_SUCCESS;
    174172}
     
    257255{
    258256    /* Prevent division by zero. */
    259     const uint32_t uHz = (pPeriod->u32Hz ? pPeriod->u32Hz : 1);
     257    const uint32_t uHz = pPeriod->u32Hz ? pPeriod->u32Hz : 1;
    260258
    261259    /* 24 MHz wall clock (WALCLK): 42ns resolution. */
     
    272270uint64_t hdaStreamPeriodGetAbsElapsedWalClk(PHDASTREAMPERIOD pPeriod)
    273271{
    274     return   pPeriod->u64StartWalClk
    275            + pPeriod->u64ElapsedWalClk
    276            + pPeriod->i64DelayWalClk;
     272    return pPeriod->u64StartWalClk
     273         + pPeriod->u64ElapsedWalClk
     274         + pPeriod->i64DelayWalClk;
    277275}
    278276
  • trunk/src/VBox/Devices/Audio/HDAStreamPeriod.h

    r69723 r71733  
    2323# include <iprt/time.h>
    2424#endif
     25#include <VBox/log.h> /* LOG_ENABLED */
    2526
    2627struct HDASTREAM;
    2728typedef HDASTREAM *PHDASTREAM;
    2829
    29 #ifdef DEBUG
     30#ifdef LOG_ENABLED
    3031/**
    3132 * Structure for debug information of an HDA stream's period.
     
    7677    uint8_t                 cIntPending;
    7778    uint8_t                 Padding3[7];
    78 #ifdef DEBUG
     79#ifdef LOG_ENABLED
    7980    /** Debugging information. */
    8081    HDASTREAMPERIODDBGINFO  Dbg;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette