DescriptionStop playing/recording when not needed.
Currently when unpublishing or unsubscribing, we still keep playing or recording
audio till it times out. We need to keep a track of which operations have
requested playing or recording and once those operations are unpublished or
unsubscribed, we need to appropriately stop the record/playback.
To do this, the first change is to stop keeping a list of tokens, instead we
just keep a list of operations. If we send our currently playing token to the
server, it is guaraunteed to _not issue another token, unless our current token
is going to expire in less time than is on the publish. In that case, we simply
replace our currently playing token with the new one, making sure that we
always just need to keep one token around.
With this, the logic for playing/recording is completely changed. Now we just
check if we have active transmit/receive, and if we do, we ensure that we are
playing our current token (or keep recording); if we do not have an active
transmit and we are playing, we stop playing. For all other cases our
ProcessNextTransmit and ProcessNextReceive is a nop.
The one ugliness in the code is that we have to keep the code for processing
the audible and inaudible tokens in the same class, since the WhispernetClient
can only give 'one' method tokens back. If two different classes call the
WhispernetClient to encode tokens, the get samples callback from the second
will overrite the callback for the first, hence the first class will never
get its samples back. Once we find a way around this, we can just have two
AudioDirectiveHandlers, one for audible and one for inaudible, but till then
we need to keep this processing together in one AudioDirectiveHandler.
R=xiyuan@chromium.org
BUG=392028
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289219
Patch Set 1 #Patch Set 2 : #
Total comments: 18
Patch Set 3 : #
Total comments: 2
Patch Set 4 : #Messages
Total messages: 13 (0 generated)
|