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

Issue 2585293002: Reducing calling to SmoothingFilter in Fec Controller. (Closed)

Created:
4 years ago by minyue-webrtc
Modified:
3 years, 11 months ago
CC:
webrtc-reviews_webrtc.org, kwiberg-webrtc, tlegrand-webrtc, tterriberry_mozilla.com, audio-team_agora.io, hlundin-webrtc, peah-webrtc, minyue-webrtc
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Reducing calling to SmoothingFilter in Fec Controller. BUG=webrtc:6303 Review-Url: https://codereview.webrtc.org/2585293002 Cr-Commit-Position: refs/heads/master@{#15806} Committed: https://chromium.googlesource.com/external/webrtc/+/e1c2d9b0a8c25d95401fe9535f411f2ce08b5e02

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+14 lines, -12 lines) Patch
M webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h View 1 chunk +4 lines, -2 lines 7 comments Download
M webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc View 2 chunks +10 lines, -10 lines 0 comments Download

Messages

Total messages: 18 (7 generated)
minyue-webrtc
Hi Michael, Please take a look at this small CL.
4 years ago (2016-12-19 16:09:13 UTC) #3
michaelt
lgtm
4 years ago (2016-12-21 16:16:59 UTC) #4
minyue-webrtc
Hi Henrik, Please also take a look!
4 years ago (2016-12-21 20:45:55 UTC) #6
hlundin-webrtc
lgtm with optional comment. https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h File webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h (right): https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h#newcode91 webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h:91: const rtc::Optional<float>& packet_loss) const; I ...
4 years ago (2016-12-22 10:42:39 UTC) #7
minyue-webrtc
https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h File webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h (right): https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h#newcode91 webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h:91: const rtc::Optional<float>& packet_loss) const; On 2016/12/22 10:42:39, hlundin-OOOtoJan9 wrote: ...
3 years, 12 months ago (2016-12-27 13:43:33 UTC) #8
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/2585293002/1
3 years, 12 months ago (2016-12-27 13:43:50 UTC) #10
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/external/webrtc/+/e1c2d9b0a8c25d95401fe9535f411f2ce08b5e02
3 years, 12 months ago (2016-12-27 14:42:53 UTC) #13
hlundin-webrtc
https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h File webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h (right): https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h#newcode91 webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h:91: const rtc::Optional<float>& packet_loss) const; On 2016/12/27 13:43:33, minyue-webrtc(OOOtoJan16) wrote: ...
3 years, 11 months ago (2017-01-09 14:46:17 UTC) #14
kwiberg-webrtc
https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h File webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h (right): https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h#newcode91 webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h:91: const rtc::Optional<float>& packet_loss) const; On 2017/01/09 14:46:16, hlundin-webrtc wrote: ...
3 years, 11 months ago (2017-01-09 14:55:19 UTC) #16
kwiberg-webrtc
https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h File webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h (right): https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h#newcode91 webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h:91: const rtc::Optional<float>& packet_loss) const; On 2017/01/09 14:55:19, kwiberg-webrtc wrote: ...
3 years, 11 months ago (2017-01-10 02:19:29 UTC) #17
hlundin-webrtc
3 years, 11 months ago (2017-01-10 08:34:07 UTC) #18
Message was sent while issue was closed.
https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/a...
File webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h (right):

https://codereview.webrtc.org/2585293002/diff/1/webrtc/modules/audio_coding/a...
webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h:91: const
rtc::Optional<float>& packet_loss) const;
On 2017/01/10 02:19:28, kwiberg-webrtc wrote:
> On 2017/01/09 14:55:19, kwiberg-webrtc wrote:
> > On 2017/01/09 14:46:16, hlundin-webrtc wrote:
> > > On 2016/12/27 13:43:33, minyue-webrtc(OOOtoJan16) wrote:
> > > > On 2016/12/22 10:42:39, hlundin-OOOtoJan9 wrote:
> > > > > I think you can pass an Optional<float> by value.
> > > > 
> > > > I am not sure about the efficiency between ref and copy when comes to
> > > Optional.
> > > > I'd like to learn about it.
> > > > 
> > > > I can commit it as it is now but would like to discuss with you about it
> and
> > > > possibly do an update in a following patch.
> > > 
> > > I think the argument from ArrayView applies here as well:
> > >
> >
>
https://chromium.googlesource.com/external/webrtc/+/master/webrtc/base/array_....
> > > 
> > > That is, the Optional type is "tiny", making it trivial to copy, and thus
> not
> > > worth to bother with pointers or references. But I usually call on
kwiberg@
> to
> > > keep me honest in these cases...
> > 
> > I'm pretty sure Henrik is right (and if I were writing this code, I would've
> > just passed it by value). But I'll see if I can whip up a small test to
verify
> > this...
> > 
> > (By the way, for non-tiny types, passing a const T* to the function is
usually
> > the optimal choice. It's just like a const reference, except that it can be
> > null...)
> 
> So, I did the experiment, and it seems like even for something as simple as
> Optional<float>, the compiler won't use registers for argument passing.
> (Presumably, this is because it's a union and not a struct under the hood. Or
> something.) So for any type T, large or small,
> 
>   1. Argument type const Optional<T>& is slightly better than const T* if the
> caller already has an Optional<T>. (It wins by a few instructions, including
one
> conditional branch.)
> 
>   2. Argument type const T* is much better than const Optional<T>& if the
caller
> doesn't already have an Optional<T>. (It wins by the cost of constructing an
> Optional<T>, which includes a conditional branch and making a copy of a T.)
> 
>   3. Argument type Optional<T> is always at least as bad as the other two
> options, since it has to make an extra copy of the Optional, which costs a
> conditional branch and making a copy of a T.
> 
> So, recommendation: Never use an Optional<T> argument. Almost always use a
const
> T* argument, except when you want to optimize hard to save a few instructions
> for the case where the caller already has an Optional<T> (in which case you
> should use const Optional<T>&).
> 
> Moral of the story: Note how my original intuition was to go with the
> alternative that turned out to be the worst of the three.
https://goo.gl/JWVCxC

Wow! Interesting findings. I stand corrected.

Powered by Google App Engine
This is Rietveld 408576698