OSDN Git Service

Hold lock when doing a route.
[android-x86/hardware-alsa_sound.git] / AudioHardwareALSA.h
index d2a9bec..e08fade 100644 (file)
@@ -199,8 +199,15 @@ public:
         return ALSAStreamOps::getParameters(keys);
     }
 
+    // return the number of audio frames written by the audio dsp to DAC since
+    // the output has exited standby
+    virtual status_t    getRenderPosition(uint32_t *dspFrames);
+
     status_t            open(int mode);
     status_t            close();
+
+private:
+    uint32_t            mFrameCount;
 };
 
 class AudioStreamInALSA : public AudioStreamIn, public ALSAStreamOps
@@ -248,12 +255,21 @@ public:
         return ALSAStreamOps::getParameters(keys);
     }
 
+    // Return the amount of input frames lost in the audio driver since the last call of this function.
+    // Audio driver is expected to reset the value to 0 and restart counting upon returning the current value by this function call.
+    // Such loss typically occurs when the user space process is blocked longer than the capacity of audio driver buffers.
+    // Unit: the number of input audio frames
+    virtual unsigned int  getInputFramesLost() const;
+
     status_t            setAcousticParams(void* params);
 
     status_t            open(int mode);
     status_t            close();
 
 private:
+    void                resetFramesLost();
+
+    unsigned int        mFramesLost;
     AudioSystem::audio_in_acoustics mAcoustics;
 };