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

Issue 2924363004: Fix Channel::GetSendCodec when used together with SetEncoder. (Closed)

Created:
3 years, 6 months ago by ossu
Modified:
3 years, 6 months ago
CC:
webrtc-reviews_webrtc.org, AleBzk, Andrew MacDonald, tterriberry_mozilla.com, audio-team_agora.io, hlundin-webrtc, peah-webrtc, the sun
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fix Channel::GetSendCodec when used together with SetEncoder. When using the SetEncoder interface, there's no actual CodecInst to return from Channel::GetSendCodec. Before this CL, this was done by calling the ACM, which has functionality for generating a CodecInst with the necessary values even when handed an external encoder. Unfortunately, this call takes a lock and does some extra processing which isn't strictly necessary in this case. Since GetSendCodec is called inside the audio input callback code, this can cause problems. This CL instead generates a CodecInst in the SetEncoder call and has GetSendCodec simply return that one if it's available. If it isn't the value from codec_manager_ is returned instead, as was the case before injectable audio codec related changes were added to Channel. BUG=b/38018041 Review-Url: https://codereview.webrtc.org/2924363004 Cr-Commit-Position: refs/heads/master@{#18515} Committed: https://chromium.googlesource.com/external/webrtc/+/76d29f9bf8604a30e01f7cc0496297efbbeac51b

Patch Set 1 #

Patch Set 2 : Remove RTC_DCHECK(false) used for debugging. :) #

Total comments: 2

Patch Set 3 : Update comments. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -19 lines) Patch
M webrtc/voice_engine/channel.h View 1 chunk +2 lines, -0 lines 0 comments Download
M webrtc/voice_engine/channel.cc View 1 2 3 chunks +30 lines, -19 lines 2 comments Download

Messages

Total messages: 33 (22 generated)
ossu
PTAL. This should fix the issues we're seeing.
3 years, 6 months ago (2017-06-09 13:28:21 UTC) #11
minyue-webrtc
On 2017/06/09 13:28:21, ossu wrote: > PTAL. This should fix the issues we're seeing. please ...
3 years, 6 months ago (2017-06-09 13:36:09 UTC) #12
ossu
On 2017/06/09 13:36:09, minyue-webrtc wrote: > On 2017/06/09 13:28:21, ossu wrote: > > PTAL. This ...
3 years, 6 months ago (2017-06-09 13:38:53 UTC) #14
henrika_webrtc
Please extend the description of what this CL changes exactly. https://codereview.webrtc.org/2924363004/diff/20001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2924363004/diff/20001/webrtc/voice_engine/channel.cc#newcode1296 ...
3 years, 6 months ago (2017-06-09 13:50:04 UTC) #15
ossu
Updated the description. https://codereview.webrtc.org/2924363004/diff/20001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2924363004/diff/20001/webrtc/voice_engine/channel.cc#newcode1296 webrtc/voice_engine/channel.cc:1296: // Store a similarily made-up CodecInst ...
3 years, 6 months ago (2017-06-09 13:54:00 UTC) #17
henrika_webrtc
lgtm
3 years, 6 months ago (2017-06-09 13:59:42 UTC) #18
minyue-webrtc
lgtm
3 years, 6 months ago (2017-06-09 14:04:06 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2924363004/40001
3 years, 6 months ago (2017-06-09 14:28:31 UTC) #27
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/external/webrtc/+/76d29f9bf8604a30e01f7cc0496297efbbeac51b
3 years, 6 months ago (2017-06-09 14:30:19 UTC) #30
the sun
https://codereview.webrtc.org/2924363004/diff/40001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2924363004/diff/40001/webrtc/voice_engine/channel.cc#newcode1304 webrtc/voice_engine/channel.cc:1304: cached_send_codec_.emplace(send_codec); Though this may work in practice - won't ...
3 years, 6 months ago (2017-06-13 09:25:07 UTC) #32
ossu
3 years, 6 months ago (2017-06-13 09:39:15 UTC) #33
Message was sent while issue was closed.
https://codereview.webrtc.org/2924363004/diff/40001/webrtc/voice_engine/chann...
File webrtc/voice_engine/channel.cc (right):

https://codereview.webrtc.org/2924363004/diff/40001/webrtc/voice_engine/chann...
webrtc/voice_engine/channel.cc:1304: cached_send_codec_.emplace(send_codec);
On 2017/06/13 09:25:07, the sun wrote:
> Though this may work in practice - won't the TSAN bots complain at some point?
> Writing on one thread, reading on another.

I was a bit worried about that as well, but having looked into it a bit, I can't
find that any of the previous code enforces thread safety either. There are
checkers in CodecManager and ChannelProxy, but no locks. C.f.
CodecManager::GetCodecInst (just returns a value in an Optional) and
CodecManager::RegisterEncoder (RTC_DCHECK(thread_checker...)).

Powered by Google App Engine
This is Rietveld 408576698