Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Issue 461803003: Stop playing/recording when not needed. (Closed)

Created:
6 years, 4 months ago by rkc
Modified:
6 years, 4 months ago
Reviewers:
xiyuan, Charlie
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, arv+watch_chromium.org, extensions-reviews_chromium.org, Charlie
Project:
chromium
Visibility:
Public.

Description

Stop 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 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+555 lines, -444 lines) Patch
M chrome/browser/copresence/chrome_whispernet_client_browsertest.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/api/copresence_private/copresence_private_api.cc View 1 2 chunks +5 lines, -3 lines 0 comments Download
M components/copresence/handlers/audio/audio_directive_handler.h View 1 2 4 chunks +79 lines, -23 lines 0 comments Download
M components/copresence/handlers/audio/audio_directive_handler.cc View 1 2 2 chunks +140 lines, -82 lines 0 comments Download
M components/copresence/handlers/audio/audio_directive_handler_unittest.cc View 1 2 4 chunks +75 lines, -43 lines 0 comments Download
M components/copresence/handlers/audio/audio_directive_list.h View 1 4 chunks +14 lines, -68 lines 0 comments Download
M components/copresence/handlers/audio/audio_directive_list.cc View 1 2 chunks +44 lines, -106 lines 0 comments Download
M components/copresence/handlers/audio/audio_directive_list_unittest.cc View 1 1 chunk +48 lines, -57 lines 0 comments Download
M components/copresence/handlers/directive_handler.h View 1 2 2 chunks +5 lines, -3 lines 0 comments Download
M components/copresence/handlers/directive_handler.cc View 1 2 3 chunks +22 lines, -4 lines 0 comments Download
M components/copresence/mediums/audio/audio_player.h View 1 2 5 chunks +15 lines, -11 lines 0 comments Download
M components/copresence/mediums/audio/audio_player.cc View 4 chunks +6 lines, -3 lines 0 comments Download
M components/copresence/mediums/audio/audio_recorder.h View 1 2 5 chunks +15 lines, -10 lines 0 comments Download
M components/copresence/mediums/audio/audio_recorder.cc View 3 chunks +6 lines, -3 lines 0 comments Download
M components/copresence/public/whispernet_client.h View 1 3 chunks +4 lines, -4 lines 0 comments Download
M components/copresence/rpc/rpc_handler.h View 1 2 chunks +10 lines, -1 line 0 comments Download
M components/copresence/rpc/rpc_handler.cc View 1 2 3 6 chunks +56 lines, -16 lines 0 comments Download
M components/copresence/rpc/rpc_handler_unittest.cc View 1 2 chunks +10 lines, -6 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
rkc
6 years, 4 months ago (2014-08-12 02:38:48 UTC) #1
rkc
+Charlie for FYI
6 years, 4 months ago (2014-08-12 02:40:11 UTC) #2
xiyuan
LGTM with nits https://codereview.chromium.org/461803003/diff/20001/chrome/browser/resources/whispernet_proxy/js/init.js File chrome/browser/resources/whispernet_proxy/js/init.js (right): https://codereview.chromium.org/461803003/diff/20001/chrome/browser/resources/whispernet_proxy/js/init.js#newcode45 chrome/browser/resources/whispernet_proxy/js/init.js:45: console.log('Got encoding request'); nit: remove debugging ...
6 years, 4 months ago (2014-08-12 18:57:51 UTC) #3
rkc
https://codereview.chromium.org/461803003/diff/20001/chrome/browser/resources/whispernet_proxy/js/init.js File chrome/browser/resources/whispernet_proxy/js/init.js (right): https://codereview.chromium.org/461803003/diff/20001/chrome/browser/resources/whispernet_proxy/js/init.js#newcode45 chrome/browser/resources/whispernet_proxy/js/init.js:45: console.log('Got encoding request'); On 2014/08/12 18:57:50, xiyuan wrote: > ...
6 years, 4 months ago (2014-08-13 00:29:00 UTC) #4
rkc
The CQ bit was checked by rkc@chromium.org
6 years, 4 months ago (2014-08-13 00:32:14 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rkc@chromium.org/461803003/40001
6 years, 4 months ago (2014-08-13 00:46:49 UTC) #6
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_chromium_chromeos_rel_swarming on tryserver.chromium.linux ...
6 years, 4 months ago (2014-08-13 04:38:29 UTC) #7
Charlie
https://codereview.chromium.org/461803003/diff/40001/components/copresence/rpc/rpc_handler.cc File components/copresence/rpc/rpc_handler.cc (right): https://codereview.chromium.org/461803003/diff/40001/components/copresence/rpc/rpc_handler.cc#newcode445 components/copresence/rpc/rpc_handler.cc:445: const std::string& audible_token = directive_handler_->CurrentAudibleToken(); directive_handler_ can be null ...
6 years, 4 months ago (2014-08-13 04:40:20 UTC) #8
Charlie
The CQ bit was unchecked by ckehoe@chromium.org
6 years, 4 months ago (2014-08-13 04:49:14 UTC) #9
rkc
https://codereview.chromium.org/461803003/diff/40001/components/copresence/rpc/rpc_handler.cc File components/copresence/rpc/rpc_handler.cc (right): https://codereview.chromium.org/461803003/diff/40001/components/copresence/rpc/rpc_handler.cc#newcode445 components/copresence/rpc/rpc_handler.cc:445: const std::string& audible_token = directive_handler_->CurrentAudibleToken(); On 2014/08/13 04:40:20, Charlie ...
6 years, 4 months ago (2014-08-13 06:06:07 UTC) #10
rkc
The CQ bit was checked by rkc@chromium.org
6 years, 4 months ago (2014-08-13 06:06:17 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rkc@chromium.org/461803003/60001
6 years, 4 months ago (2014-08-13 06:07:37 UTC) #12
commit-bot: I haz the power
6 years, 4 months ago (2014-08-13 08:53:01 UTC) #13
Message was sent while issue was closed.
Change committed as 289219

Powered by Google App Engine
This is Rietveld 408576698