From 6dc4906e262cb101a0e3cfe1902eb45a7bfb2eb9 Mon Sep 17 00:00:00 2001
From: Dario Casalinuovo <b.vitruvio@gmail.com>
Date: Tue, 7 Apr 2015 18:15:04 +0200
Subject: [PATCH 2/2] Clean SharedBufferList.h.
---
headers/private/media/SharedBufferList.h | 63 ++++++++++++++++++--------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/headers/private/media/SharedBufferList.h b/headers/private/media/SharedBufferList.h
index c5b93b1..8c84a78 100644
a
|
b
|
|
13 | 13 | namespace BPrivate { |
14 | 14 | |
15 | 15 | |
16 | | class SharedBufferList { |
| 16 | class SharedBufferList |
| 17 | { |
17 | 18 | public: |
18 | | static area_id Create(SharedBufferList** _list); |
19 | | static SharedBufferList* Get(); |
20 | | static void Invalidate(); |
21 | | |
22 | | void Put(); |
23 | | void DeleteGroupAndPut(sem_id groupReclaimSem); |
24 | | |
25 | | status_t Lock(); |
26 | | status_t Unlock(); |
27 | | |
28 | | status_t AddBuffer(sem_id groupReclaimSem, |
29 | | BBuffer* buffer); |
30 | | status_t RequestBuffer(sem_id groupReclaimSem, |
31 | | int32 buffersInGroup, size_t size, |
32 | | media_buffer_id wantID, BBuffer** _buffer, |
33 | | bigtime_t timeout); |
34 | | status_t RecycleBuffer(BBuffer* buffer); |
35 | | status_t GetBufferList(sem_id groupReclaimSem, |
36 | | int32 bufferCount, BBuffer** buffers); |
| 19 | static area_id Create(SharedBufferList** _list); |
| 20 | static SharedBufferList* Get(); |
| 21 | static void Invalidate(); |
37 | 22 | |
| 23 | void Put(); |
| 24 | void DeleteGroupAndPut( |
| 25 | sem_id groupReclaimSem); |
| 26 | |
| 27 | status_t Lock(); |
| 28 | status_t Unlock(); |
| 29 | |
| 30 | status_t AddBuffer(sem_id groupReclaimSem, |
| 31 | BBuffer* buffer); |
| 32 | |
| 33 | status_t RequestBuffer(sem_id groupReclaimSem, |
| 34 | int32 buffersInGroup, size_t size, |
| 35 | media_buffer_id wantID, |
| 36 | BBuffer** _buffer, |
| 37 | bigtime_t timeout); |
| 38 | |
| 39 | status_t RecycleBuffer(BBuffer* buffer); |
| 40 | |
| 41 | status_t GetBufferList(sem_id groupReclaimSem, |
| 42 | int32 bufferCount, |
| 43 | BBuffer** buffers); |
38 | 44 | private: |
39 | 45 | struct _shared_buffer_info { |
40 | 46 | media_buffer_id id; |
… |
… |
private:
|
45 | 51 | sem_id reclaim_sem; |
46 | 52 | }; |
47 | 53 | |
| 54 | // 16 bytes per buffer, 8 pages in total (one entry less for the list) |
48 | 55 | enum { kMaxBuffers = 2047 }; |
49 | | // 16 bytes per buffer, 8 pages in total (one entry less for the list) |
50 | 56 | |
51 | | status_t _Init(); |
52 | | void _RequestBufferInOtherGroups( |
53 | | sem_id groupReclaimSem, media_buffer_id id); |
| 57 | status_t _Init(); |
| 58 | void _RequestBufferInOtherGroups( |
| 59 | sem_id groupReclaimSem, |
| 60 | media_buffer_id id); |
54 | 61 | |
55 | 62 | private: |
56 | | sem_id fSemaphore; |
57 | | int32 fAtom; |
| 63 | sem_id fSemaphore; |
| 64 | int32 fAtom; |
58 | 65 | |
59 | | _shared_buffer_info fInfos[kMaxBuffers]; |
60 | | int32 fCount; |
| 66 | _shared_buffer_info fInfos[kMaxBuffers]; |
| 67 | int32 fCount; |
61 | 68 | }; |
62 | 69 | |
63 | 70 | |