diff options
-rw-r--r-- | include/media/AudioBufferProvider.h | 12 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/include/media/AudioBufferProvider.h b/include/media/AudioBufferProvider.h index 43e4de7..865ed7e 100644 --- a/include/media/AudioBufferProvider.h +++ b/include/media/AudioBufferProvider.h @@ -36,8 +36,11 @@ public: size_t frameCount; }; - virtual ~AudioBufferProvider() {} +protected: + AudioBufferProvider() : mValid(kValid) { } + virtual ~AudioBufferProvider() { mValid = kDead; } +public: // value representing an invalid presentation timestamp static const int64_t kInvalidPTS = 0x7FFFFFFFFFFFFFFFLL; // <stdint.h> is too painful @@ -47,6 +50,13 @@ public: virtual status_t getNextBuffer(Buffer* buffer, int64_t pts = kInvalidPTS) = 0; virtual void releaseBuffer(Buffer* buffer) = 0; + + int getValid() const { return mValid; } + static const int kValid = 'GOOD'; + static const int kDead = 'DEAD'; + +private: + int mValid; }; // ---------------------------------------------------------------------------- diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index af169d5..1e4049a 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -1098,6 +1098,12 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts) e0 &= ~(1<<i); track_t& t = state->tracks[i]; t.buffer.frameCount = state->frameCount; + int valid = t.bufferProvider->getValid(); + if (valid != AudioBufferProvider::kValid) { + ALOGE("invalid bufferProvider=%p name=%d frameCount=%d valid=%#x enabledTracks=%#x", + t.bufferProvider, i, t.buffer.frameCount, valid, enabledTracks); + // expect to crash + } t.bufferProvider->getNextBuffer(&t.buffer, pts); t.frameCount = t.buffer.frameCount; t.in = t.buffer.raw; |