[haiku-development] Re: BBufferGroup questions for future work

  • From: Jérôme Duval <jerome.duval@xxxxxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Tue, 7 Apr 2015 23:29:21 +0200

2015-04-07 20:50 GMT+02:00 Dario Casalinuovo <b.vitruvio@xxxxxxxxx>:

I don't have much experience with this code, I'll to try to answer
with my understanding.


A TODO in BBufferGroup #110 states that we should avoid to add more than one
BBuffer::ID() to each group, but in SharedBufferList there's a function
named _RequestBuffersInOtherGroups that find in the current list buffers
with the same ID. i've guessed that it's a workaround and should be removed.

I believe it's poor wording. There shouldn't be any duplicate ID in
one buffer group and this check is still missing.
SharedBufferList manages buffers in multiple teams, I think, by
searching other buffer groups with the same buffer ID. This isn't a
workaround.


Secondarily, i've found that when the consumer set the BBufferGroup of the
producer and they live in the same team there's just this situation of a new
group created with the consumer's buffers and since the SharedBufferList is
a static variable those buffers are just duplicated (BBufferProducer line
#270). I've tried to fix it by detecting if we live in the same team, and in
case just create a BBufferGroup with the blank constructor.

The code tries to instanciate a new BufferGroup with a list of IDs to
be cloned. This isn't really a problem, if the used buffers are the
same in the same team.


To be more clear, should i return an error when BBufferGroup::AddBuffer find
that the ID is already present? And in case i'm right, how should work
reclaiming buffers from other groups?

Yes to the first, though I don't understand how this affects the
second question.


Unfortunately i'm realizing the media_kit is in pitiful state and my changes
actually break something on the client side but before to go forward and
make it to work i want to be sure i'm doing the correct assumptions. In
particular, the current code seems to workaround having duplicated buffer
IDs and from what i can understand this problem should just be resolved.

Then maybe a better idea would be to first log an error instead of
failing badly.

Bye,
Jérôme

Other related posts: