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

Issue 1725143003: Changed AudioEncoder::Encode to take an rtc::Buffer* instead of uint8_t* and a maximum size. (Closed)

Created:
4 years, 10 months ago by ossu
Modified:
4 years, 9 months ago
CC:
webrtc-reviews_webrtc.org, tlegrand-webrtc, tterriberry_mozilla.com, audio-team_agora.io, hlundin-webrtc, peah-webrtc, minyue-webrtc
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Changed AudioEncoder::Encode to take an rtc::Buffer* instead of uint8_t* and a maximum size. For backwards compatibility, I've added kept the old interface to Encode() and EncodeInternal and created default implementations of both variants of EncodeInternal(), each calling the other. At least one of the variants must be implemented in a subclass or we'll run out of stack and explode. Would be nice if we could catch that before runtime. :/ The new interface to EncodeInternal() is protected, since it should never be called from the outside. Was unable to mark the old EncodeInternal() as RTC_DEPRECATED, since the default implementaion of the new variant needs to call it to work around old implementations. The old Encode() variant is deprecated, at least. Added a test for backwards compatibility in audio_encoder_unittest.cc. For the added test I broke out MockEncodeHelper from audio_encoder_copy_red_unittest.cc and renamed it MockAudioEncoderHelper. Committed: https://crrev.com/10a029e95216c568d9bba9714e52edd761cf9054 Cr-Commit-Position: refs/heads/master@{#11823}

Patch Set 1 #

Patch Set 2 : Reverted unnecessary change to buffer_unittest.cc #

Total comments: 50

Patch Set 3 : Fixed issues from comments, rewrote MockAudioEncoderHelper #

Total comments: 6

Patch Set 4 : Removed use of <functional> and moved MockAudioEncoderHelper things into the respective MockAudioEn… #

Total comments: 20

Patch Set 5 : Fixed a number of issues based on comments #

Patch Set 6 : Added fix for gcc with -Woverloaded-virtual warning about AudioEncoder::EncodeInternal #

Patch Set 7 : Added more fixes for override hiding in AudioEncoder implementations. #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+639 lines, -317 lines) Patch
M webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc View 1 2 5 chunks +10 lines, -9 lines 0 comments Download
M webrtc/modules/audio_coding/acm2/rent_a_codec_unittest.cc View 4 chunks +8 lines, -8 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/audio_encoder.h View 1 2 3 chunks +44 lines, -13 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/audio_encoder.cc View 1 2 3 4 2 chunks +49 lines, -0 lines 0 comments Download
A webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc View 1 2 3 1 chunk +64 lines, -0 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h View 1 2 3 4 5 6 3 chunks +5 lines, -6 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc View 5 chunks +32 lines, -30 lines 3 comments Download
M webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc View 1 2 3 8 chunks +11 lines, -12 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h View 1 2 3 4 5 2 chunks +6 lines, -4 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc View 2 chunks +7 lines, -4 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h View 1 2 3 4 5 2 chunks +6 lines, -3 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc View 1 2 3 4 2 chunks +29 lines, -26 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h View 1 2 3 4 5 6 2 chunks +3 lines, -2 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc View 1 2 3 4 2 chunks +18 lines, -12 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h View 1 2 3 4 5 6 2 chunks +3 lines, -2 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h View 1 2 2 chunks +13 lines, -10 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h View 1 2 3 4 5 6 3 chunks +87 lines, -8 lines 0 comments Download
A webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.cc View 1 2 3 1 chunk +74 lines, -0 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h View 1 2 3 4 5 3 chunks +7 lines, -5 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc View 1 2 3 4 2 chunks +41 lines, -30 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h View 1 2 3 4 5 3 chunks +7 lines, -4 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc View 1 2 2 chunks +9 lines, -8 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc View 1 2 3 13 chunks +40 lines, -66 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc View 1 2 3 4 12 chunks +25 lines, -29 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/test/neteq_isac_quality_test.cc View 3 chunks +7 lines, -3 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/test/neteq_opus_quality_test.cc View 2 chunks +17 lines, -9 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M webrtc/modules/modules.gyp View 1 2 3 4 2 chunks +2 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 41 (14 generated)
ossu
Please take a look at these changes. Should anyone else review this as well? https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc ...
4 years, 10 months ago (2016-02-24 13:24:34 UTC) #4
kwiberg-webrtc
https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc File webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc (right): https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc#newcode1636 webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc:1636: .WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::MaxEncodedBytes)); Do you still need this one? https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/audio_encoder.cc ...
4 years, 10 months ago (2016-02-25 00:29:04 UTC) #5
kwiberg-webrtc
On 2016/02/24 13:24:34, ossu wrote: > Please take a look at these changes. Should anyone ...
4 years, 9 months ago (2016-02-25 09:25:02 UTC) #7
ossu
https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc File webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc (right): https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc#newcode1636 webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc:1636: .WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::MaxEncodedBytes)); On 2016/02/25 00:29:04, kwiberg-webrtc wrote: > Do ...
4 years, 9 months ago (2016-02-25 10:39:52 UTC) #8
kwiberg-webrtc
https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/audio_encoder.cc File webrtc/modules/audio_coding/codecs/audio_encoder.cc (right): https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/audio_encoder.cc#newcode39 webrtc/modules/audio_coding/codecs/audio_encoder.cc:39: return info; On 2016/02/25 10:39:51, ossu wrote: > On ...
4 years, 9 months ago (2016-02-25 12:24:25 UTC) #9
ossu
A whole slew of small updates. The biggest thing is I rewrote MockAudioEncoderHelper, since it ...
4 years, 9 months ago (2016-02-25 15:58:46 UTC) #10
kwiberg-webrtc
It’s converging! I’ve almost run out of things to complain about. :-) https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc File webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc ...
4 years, 9 months ago (2016-02-27 19:21:46 UTC) #11
ossu
https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc File webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc (right): https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc#newcode100 webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc:100: encoded.data()); On 2016/02/27 19:21:46, kwiberg-webrtc wrote: > On 2016/02/25 ...
4 years, 9 months ago (2016-02-29 08:51:24 UTC) #12
ossu
4 years, 9 months ago (2016-02-29 11:21:28 UTC) #13
kwiberg-webrtc
lgtm https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc File webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc (right): https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc#newcode100 webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc:100: encoded.data()); On 2016/02/29 08:51:23, ossu wrote: > On ...
4 years, 9 months ago (2016-02-29 11:42:47 UTC) #14
kwiberg-webrtc
lgtm
4 years, 9 months ago (2016-02-29 11:42:54 UTC) #15
ossu
https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc File webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc (right): https://codereview.webrtc.org/1725143003/diff/20001/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc#newcode100 webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc:100: encoded.data()); On 2016/02/29 11:42:47, kwiberg-webrtc wrote: > On 2016/02/29 ...
4 years, 9 months ago (2016-02-29 11:56:52 UTC) #16
hlundin-webrtc
Nice CL! I have a few comments and questions. https://codereview.webrtc.org/1725143003/diff/60001/webrtc/modules/audio_coding/codecs/audio_encoder.cc File webrtc/modules/audio_coding/codecs/audio_encoder.cc (right): https://codereview.webrtc.org/1725143003/diff/60001/webrtc/modules/audio_coding/codecs/audio_encoder.cc#newcode57 webrtc/modules/audio_coding/codecs/audio_encoder.cc:57: ...
4 years, 9 months ago (2016-02-29 12:46:47 UTC) #17
ossu
https://codereview.webrtc.org/1725143003/diff/60001/webrtc/modules/audio_coding/codecs/audio_encoder.cc File webrtc/modules/audio_coding/codecs/audio_encoder.cc (right): https://codereview.webrtc.org/1725143003/diff/60001/webrtc/modules/audio_coding/codecs/audio_encoder.cc#newcode57 webrtc/modules/audio_coding/codecs/audio_encoder.cc:57: EncodeInternal(rtp_timestamp, audio, On 2016/02/29 12:46:47, hlundin-webrtc wrote: > What ...
4 years, 9 months ago (2016-02-29 13:23:01 UTC) #18
hlundin-webrtc
LGTM. Well done. We can resolve my one remaining discussion point offline. https://codereview.webrtc.org/1725143003/diff/60001/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc File webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc ...
4 years, 9 months ago (2016-02-29 14:46:10 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1725143003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1725143003/80001
4 years, 9 months ago (2016-02-29 16:02:34 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: android_compile_x64_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_compile_x64_dbg/builds/2026)
4 years, 9 months ago (2016-02-29 16:10:19 UTC) #24
ossu
Alright. Fixed an issue where implementing one EncodeInternal variant in a subclass would hide the ...
4 years, 9 months ago (2016-02-29 16:45:25 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1725143003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1725143003/120001
4 years, 9 months ago (2016-02-29 16:45:41 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: android_arm64_rel on tryserver.webrtc (JOB_TIMED_OUT, no build URL) android_dbg on ...
4 years, 9 months ago (2016-02-29 18:46:30 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1725143003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1725143003/120001
4 years, 9 months ago (2016-03-01 08:31:45 UTC) #32
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 9 months ago (2016-03-01 08:41:38 UTC) #34
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/10a029e95216c568d9bba9714e52edd761cf9054 Cr-Commit-Position: refs/heads/master@{#11823}
4 years, 9 months ago (2016-03-01 08:41:46 UTC) #36
The Sun (google.com)
Good stuff! https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc File webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc (right): https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc#newcode211 webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc:211: encoded->AppendData(bytes_to_encode, [&] (rtc::ArrayView<uint8_t> encoded) { FYI: Chromium ...
4 years, 9 months ago (2016-03-01 21:06:15 UTC) #38
ossu
https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc File webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc (right): https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc#newcode211 webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc:211: encoded->AppendData(bytes_to_encode, [&] (rtc::ArrayView<uint8_t> encoded) { On 2016/03/01 21:06:15, solenberg ...
4 years, 9 months ago (2016-03-02 08:39:43 UTC) #39
kwiberg-webrtc
https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc File webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc (right): https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc#newcode211 webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc:211: encoded->AppendData(bytes_to_encode, [&] (rtc::ArrayView<uint8_t> encoded) { On 2016/03/02 08:39:42, ossu ...
4 years, 9 months ago (2016-03-02 09:40:24 UTC) #40
the sun
4 years, 9 months ago (2016-03-02 10:00:29 UTC) #41
Message was sent while issue was closed.
On 2016/03/02 09:40:24, kwiberg-webrtc wrote:
>
https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_cod...
> File webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc (right):
> 
>
https://codereview.webrtc.org/1725143003/diff/120001/webrtc/modules/audio_cod...
> webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc:211:
> encoded->AppendData(bytes_to_encode, [&] (rtc::ArrayView<uint8_t> encoded) {
> On 2016/03/02 08:39:42, ossu wrote:
> > On 2016/03/01 21:06:15, solenberg wrote:
> > > FYI: Chromium C++11 style guide says to not use default captures:
> > > https://chromium-cpp.appspot.com/
> > 
> > Well yes, and no. It says don't use it, referring to the Google Style Guide,
> > which says "Use default captures judiciously, when it aids readability
[...]".
> > You can surely get turned around by default captures, but I believe this
usage
> > is straight-forward enough: the code in the lambda is code that would
> otherwise
> > be in the function's scope (probably at that same point), which does have
> access
> > to this and all the local variables.
> 
> Yes. The Google style guide used to blanket ban default capture, but that was
> changed to the current text, which says "Avoid default lambda captures when
> capturing this or if the lambda will escape the current scope.". I'm guessing
> the Chromium C++11 text simply hasn't been updated.
> 
> By the letter of the text, I guess you should write [&, this], though---but I
> certainly won't insist, since I don't think it makes sense to special-case
> "this" once we have the "no default capture if the lambda escapes" rule.

Ack. Thanks for the info!

Powered by Google App Engine
This is Rietveld 408576698