diff options
author | Glenn Kasten <gkasten@google.com> | 2014-02-03 17:34:17 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-02-03 17:34:18 +0000 |
commit | e726d65778ce78092010df2354156c09d311423f (patch) | |
tree | 022f736f49f5e0bb36ccc56724a1605ccd3829b2 /include | |
parent | 0520e05f9083cf13fa7062629bc6606f4b39f08a (diff) | |
parent | fdac7c00f9201bb3a9862069145f01d37e39755b (diff) | |
download | frameworks_av-e726d65778ce78092010df2354156c09d311423f.zip frameworks_av-e726d65778ce78092010df2354156c09d311423f.tar.gz frameworks_av-e726d65778ce78092010df2354156c09d311423f.tar.bz2 |
Merge "Replace size_t in shared memory by uint32_t"
Diffstat (limited to 'include')
-rw-r--r-- | include/private/media/AudioTrackShared.h | 14 | ||||
-rw-r--r-- | include/private/media/StaticAudioTrackState.h | 10 |
2 files changed, 18 insertions, 6 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h index b5a4c0b..3901e79 100644 --- a/include/private/media/AudioTrackShared.h +++ b/include/private/media/AudioTrackShared.h @@ -65,7 +65,9 @@ typedef SingleStateQueue<StaticAudioTrackState> StaticAudioTrackSingleStateQueue struct AudioTrackSharedStatic { StaticAudioTrackSingleStateQueue::Shared mSingleStateQueue; - size_t mBufferPosition; // updated asynchronously by server, + // This field should be a size_t, but since it is located in shared memory we + // force to 32-bit. The client and server may have different typedefs for size_t. + uint32_t mBufferPosition; // updated asynchronously by server, // "for entertainment purposes only" }; @@ -104,7 +106,9 @@ struct audio_track_cblk_t private: - size_t mMinimum; // server wakes up client if available >= mMinimum + // This field should be a size_t, but since it is located in shared memory we + // force to 32-bit. The client and server may have different typedefs for size_t. + uint32_t mMinimum; // server wakes up client if available >= mMinimum // Channel volumes are fixed point U4.12, so 0x1000 means 1.0. // Left channel is in [0:15], right channel is in [16:31]. @@ -241,7 +245,11 @@ public: } void setMinimum(size_t minimum) { - mCblk->mMinimum = minimum; + // This can only happen on a 64-bit client + if (minimum > UINT32_MAX) { + minimum = UINT32_MAX; + } + mCblk->mMinimum = (uint32_t) minimum; } // Return the number of frames that would need to be obtained and released diff --git a/include/private/media/StaticAudioTrackState.h b/include/private/media/StaticAudioTrackState.h index 46a5946..d483061 100644 --- a/include/private/media/StaticAudioTrackState.h +++ b/include/private/media/StaticAudioTrackState.h @@ -25,9 +25,13 @@ namespace android { // state is wrapped by a SingleStateQueue. struct StaticAudioTrackState { // do not define constructors, destructors, or virtual methods - size_t mLoopStart; - size_t mLoopEnd; - int mLoopCount; + + // These fields should both be size_t, but since they are located in shared memory we + // force to 32-bit. The client and server may have different typedefs for size_t. + uint32_t mLoopStart; + uint32_t mLoopEnd; + + int mLoopCount; }; } // namespace android |