119 Commits

Author SHA1 Message Date
kwiberg
c13ded54ca Move AudioCodingModuleImpl to anonymous namespace in audio_coding_module.cc
AudioCodingModuleImpl is the only implementation of the
AudioCodingModule interface (except for test mocks). So it's a good
fit to put it in an anonymous namespace in the interface's .cc file,
to ensure that no one except AudioCodingModule::Create ever references
it.

Except for moving code, this CL introduces two other small changes:

  * It cleans up the set of #includes in audio_coding_module.cc.
    Specifically, I removed #includes that were already present in
    audio_coding_module.h, and did not bring along any #includes from
    audio_coding_module_impl.h and .cc except those that were
    necessary to get it to compile.

  * It moves AudioCodingModuleImpl from the webrtc::acm2 to the
    webrtc::<anonymous> namespace. This means I had to qualify a few
    things it references with acm2::.

Review-Url: https://codereview.webrtc.org/2069723003
Cr-Commit-Position: refs/heads/master@{#13191}
2016-06-17 13:00:52 +00:00
kwiberg
342f74005f NetEq: Ask AudioDecoder for sample rate instead of passing it as an argument
BUG=webrtc:5801
NOTRY=true

Review-Url: https://codereview.webrtc.org/2027993002
Cr-Commit-Position: refs/heads/master@{#13162}
2016-06-16 10:18:09 +00:00
kwiberg
abe95ba323 AudioDecoderIsacT: Require caller to always specify sample rate
This gets rid of the complex & icky state where the sample rate is not
yet determined.

BUG=webrtc:5801

Review-Url: https://codereview.webrtc.org/2020353003
Cr-Commit-Position: refs/heads/master@{#13011}
2016-06-02 09:59:02 +00:00
Tommi
90edc65929 Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2018553002/ )
Adding a some checks and switching out a few assert for RTC_[D]CHECK.
These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.

TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Committed: https://crrev.com/60c4e0ae8f124f08372645a95042f4a1246d7aa3
Cr-Commit-Position: refs/heads/master@{#12925}

Committed: https://crrev.com/5771beb265129082d31736259b7dc6ca037cff4d
Cr-Commit-Position: refs/heads/master@{#12926}

Committed: https://crrev.com/54e1c6a500e390e543bce7b78fae65eb9bb14ab6
Cr-Commit-Position: refs/heads/master@{#12927}

Committed: https://crrev.com/f9d2fe983fe196373850c55acd3dc3824add480e
Cr-Commit-Position: refs/heads/master@{#12928}

Committed: f4fc0ff6f9

Committed: https://crrev.com/c47f0099eee08e8b6731a359563ba09dfe453ded
Cr-Commit-Position: refs/heads/master@{#12930}

Committed: https://crrev.com/0ad72ead67ce848b45541af6aba0a15486b5e0a7
Cr-Commit-Position: refs/heads/master@{#12931}

Review URL: https://codereview.webrtc.org/2014973002 .

Cr-Commit-Position: refs/heads/master@{#12933}
2016-05-26 21:48:27 +00:00
Tommi
5771beb265 Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2018553002/ )
Adding a some checks and switching out a few assert for RTC_[D]CHECK.
These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.

TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Committed: https://crrev.com/60c4e0ae8f124f08372645a95042f4a1246d7aa3
Cr-Commit-Position: refs/heads/master@{#12925}

Review URL: https://codereview.webrtc.org/2014973002 .

Cr-Commit-Position: refs/heads/master@{#12926}
2016-05-26 19:51:41 +00:00
tommi
b4ff7a7a8b Revert of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2014183003/ )
Reason for revert:
Alas, the bot magically fails again.  Looks like indeed it's a Clang bug :(

https://build.chromium.org/p/client.webrtc/builders/Win64%20Debug%20%28Clang%29/builds/1687

Original issue's description:
> Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2006313009/ )
>
> Reason for revert:
> Relanding.  The errors look like legit disk space problems so I'm going to watch the bots this time.
>
> Original issue's description:
> > Revert of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2009253004/ )
> >
> > Reason for revert:
> > Fails unexpectedly on multiple commit bots:
> > https://build.chromium.org/p/client.webrtc/builders/Win32%20Debug%20%28Clang%29/builds/1748
> > https://build.chromium.org/p/client.webrtc/builders/Win64%20Debug%20%28Clang%29/builds/1683
> >
> > I filed https://bugs.chromium.org/p/chromium/issues/detail?id=614967 to track the problem. I'll reland if it doesn't solve the problem.
> >
> > Original issue's description:
> > > Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2006243002/ )
> > >
> > > Original issue's description:
> > > > Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> > > > These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
> > > >
> > > > BUG=chromium:613482
> > > > NOTRY=true
> > > > (using notry due to offline android_arm64_rel bot)
> > > >
> > > > Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> > > > Cr-Commit-Position: refs/heads/master@{#12870}
> > >
> > > TBR=henrik.lundin@webrtc.org
> > > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > > BUG=chromium:613482
> > >
> > > Committed: https://crrev.com/ba189cc4f4f6fe311a815646059e8011ffa53894
> > > Cr-Commit-Position: refs/heads/master@{#12907}
> >
> > TBR=henrik.lundin@webrtc.org,tommi@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=chromium:613482
> >
> > Committed: https://crrev.com/6895d8ca788df29f4d3a4b97fe891f0fb3a6dbec
> > Cr-Commit-Position: refs/heads/master@{#12909}
>
> TBR=henrik.lundin@webrtc.org,kjellander@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=chromium:613482
>
> Committed: https://crrev.com/b7318f1293453d8d319e27473c5bfb72292ebfd2
> Cr-Commit-Position: refs/heads/master@{#12920}

TBR=henrik.lundin@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:613482

Review-Url: https://codereview.webrtc.org/2018553002
Cr-Commit-Position: refs/heads/master@{#12921}
2016-05-26 15:27:43 +00:00
tommi
b7318f1293 Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2006313009/ )
Reason for revert:
Relanding.  The errors look like legit disk space problems so I'm going to watch the bots this time.

Original issue's description:
> Revert of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2009253004/ )
>
> Reason for revert:
> Fails unexpectedly on multiple commit bots:
> https://build.chromium.org/p/client.webrtc/builders/Win32%20Debug%20%28Clang%29/builds/1748
> https://build.chromium.org/p/client.webrtc/builders/Win64%20Debug%20%28Clang%29/builds/1683
>
> I filed https://bugs.chromium.org/p/chromium/issues/detail?id=614967 to track the problem. I'll reland if it doesn't solve the problem.
>
> Original issue's description:
> > Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2006243002/ )
> >
> > Original issue's description:
> > > Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> > > These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
> > >
> > > BUG=chromium:613482
> > > NOTRY=true
> > > (using notry due to offline android_arm64_rel bot)
> > >
> > > Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> > > Cr-Commit-Position: refs/heads/master@{#12870}
> >
> > TBR=henrik.lundin@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=chromium:613482
> >
> > Committed: https://crrev.com/ba189cc4f4f6fe311a815646059e8011ffa53894
> > Cr-Commit-Position: refs/heads/master@{#12907}
>
> TBR=henrik.lundin@webrtc.org,tommi@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=chromium:613482
>
> Committed: https://crrev.com/6895d8ca788df29f4d3a4b97fe891f0fb3a6dbec
> Cr-Commit-Position: refs/heads/master@{#12909}

TBR=henrik.lundin@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:613482

Review-Url: https://codereview.webrtc.org/2014183003
Cr-Commit-Position: refs/heads/master@{#12920}
2016-05-26 15:17:29 +00:00
kjellander
6895d8ca78 Revert of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2009253004/ )
Reason for revert:
Fails unexpectedly on multiple commit bots:
https://build.chromium.org/p/client.webrtc/builders/Win32%20Debug%20%28Clang%29/builds/1748
https://build.chromium.org/p/client.webrtc/builders/Win64%20Debug%20%28Clang%29/builds/1683

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=614967 to track the problem. I'll reland if it doesn't solve the problem.

Original issue's description:
> Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2006243002/ )
>
> Original issue's description:
> > Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> > These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
> >
> > BUG=chromium:613482
> > NOTRY=true
> > (using notry due to offline android_arm64_rel bot)
> >
> > Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> > Cr-Commit-Position: refs/heads/master@{#12870}
>
> TBR=henrik.lundin@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:613482
>
> Committed: https://crrev.com/ba189cc4f4f6fe311a815646059e8011ffa53894
> Cr-Commit-Position: refs/heads/master@{#12907}

TBR=henrik.lundin@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:613482

Review-Url: https://codereview.webrtc.org/2006313009
Cr-Commit-Position: refs/heads/master@{#12909}
2016-05-26 09:46:59 +00:00
tommi
ba189cc4f4 Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2006243002/ )
Original issue's description:
> Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
>
> BUG=chromium:613482
> NOTRY=true
> (using notry due to offline android_arm64_rel bot)
>
> Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> Cr-Commit-Position: refs/heads/master@{#12870}

TBR=henrik.lundin@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=chromium:613482

Review-Url: https://codereview.webrtc.org/2009253004
Cr-Commit-Position: refs/heads/master@{#12907}
2016-05-26 09:13:14 +00:00
ossu
e352578bc8 Moved injection of AudioDecoderFactory into voe::Channel.
Channel's API remains unchanged, but the creation of a BuiltinAudioDecoderFactory is now in Channel. The next step would be to amend Channel's API (through CreateChannel, I believe) to allow an AudioDecoderFactory to be sent along.

BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/1992763002
Cr-Commit-Position: refs/heads/master@{#12893}
2016-05-25 14:37:47 +00:00
henrik.lundin
46ba49c622 Let PacketSource::NextPacket() return an std::unique_ptr
The return type of PacketSource::NextPacket() is changed from a naked
pointer to an std::uniqe_ptr. The interface contract was and still is
that the ownership is passed from the callee to the caller, but a
unique_ptr makes this explicit.

BUG=webrtc:2692

Review-Url: https://codereview.webrtc.org/2005873002
Cr-Commit-Position: refs/heads/master@{#12884}
2016-05-25 05:50:54 +00:00
tommi
fb98b9edb4 Revert of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #6 id:100001 of https://codereview.webrtc.org/2007563002/ )
Reason for revert:
Reverting temporarily.  Need to fix tests downstream that pass invalid arguments.

Original issue's description:
> Adding a some checks and switching out a few assert for RTC_[D]CHECK.
> These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
>
> BUG=chromium:613482
> NOTRY=true
> (using notry due to offline android_arm64_rel bot)
>
> Committed: https://crrev.com/d36df89d40bde3c62ee5cbff841933e50b3c007b
> Cr-Commit-Position: refs/heads/master@{#12870}

TBR=henrik.lundin@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:613482

Review-Url: https://codereview.webrtc.org/2006243002
Cr-Commit-Position: refs/heads/master@{#12874}
2016-05-24 13:44:36 +00:00
tommi
d36df89d40 Adding a some checks and switching out a few assert for RTC_[D]CHECK.
These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled.  I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.

BUG=chromium:613482
NOTRY=true
(using notry due to offline android_arm64_rel bot)

Review-Url: https://codereview.webrtc.org/2007563002
Cr-Commit-Position: refs/heads/master@{#12870}
2016-05-24 12:49:10 +00:00
henrik.lundin
d4ccb00b9e Propagate muted parameter to VoE::Channel
Deleted the temporary ACM method without the muted parameter, and had
to modify several tests for this. The muted parameter is not yet propagated to the AudioConferenceMixer; this is the next step.

BUG=webrtc:5609
TBR=perkj@webrtc.org

Review-Url: https://codereview.webrtc.org/1985743002
Cr-Commit-Position: refs/heads/master@{#12779}
2016-05-17 19:22:03 +00:00
aleloi
8bce67b745 Added UMA logging for audio codec usage. A histogram statistic named "WebRTC.Audio.Encoder.CodecType" has been created.
Review-Url: https://codereview.webrtc.org/1967503002
Cr-Commit-Position: refs/heads/master@{#12760}
2016-05-16 14:34:31 +00:00
henrik.lundin
834a6ea12b Add muted_output parameter to ACM
The new parameter indicates if the output in the AudioFrame is muted. If
so, the output samples are not written, but should be interpreted as all
zero.

A version of AudioCodingModule::PlayoutData10Ms() without the new
parameter is maintained while waiting for downstream dependencies to
conform.

BUG=webrtc:5609

Review-Url: https://codereview.webrtc.org/1976913002
Cr-Commit-Position: refs/heads/master@{#12719}
2016-05-13 10:45:31 +00:00
henrik.lundin
7a926812d8 NetEq: Implement muted output
This CL implements the muted output functionality in NetEq. Tests are
added. The feature is currently off by default, and AcmReceiver makes
sure that the muted state is not engaged.

BUG=webrtc:5608

Review-Url: https://codereview.webrtc.org/1965733002
Cr-Commit-Position: refs/heads/master@{#12711}
2016-05-12 20:51:37 +00:00
Niels Möller
d28db7fd65 Delete all use of tick_util.h.
Depends on Chrome cl https://codereview.chromium.org/1888003002/, which was landed some time ago.

BUG=webrtc:5740
R=stefan@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1888593004 .

Cr-Commit-Position: refs/heads/master@{#12674}
2016-05-10 14:31:58 +00:00
kwiberg
5178ee86ba NetEq: Use a BuiltinAudioDecoderFactory to create decoders
Later steps in the refactoring will have the factory injected from the
outside rather than owned by NetEq.

BUG=webrtc:5801

Review-Url: https://codereview.webrtc.org/1928293002
Cr-Commit-Position: refs/heads/master@{#12604}
2016-05-03 08:39:08 +00:00
minyue
53ff70f582 Reland "Avoiding overflow in cross correlation in NetEq."
The original CL is https://codereview.webrtc.org/1908623002/

An error was caused by that and this CL fix that problem and reland the CL.

BUG=

Review-Url: https://codereview.webrtc.org/1931933004
Cr-Commit-Position: refs/heads/master@{#12589}
2016-05-02 08:50:34 +00:00
nisse
ef8b61e110 Enable -Winconsistent-missing-override flag.
The problem with gmock is worked around by commenting out any other override declarations in classes using gmock.

NOPRESUBMIT=True
BUG=webrtc:3970

Review-Url: https://codereview.webrtc.org/1921653002
Cr-Commit-Position: refs/heads/master@{#12563}
2016-04-29 13:09:23 +00:00
minyue
8c22962474 Revert of Avoiding overflow in cross correlation in NetEq. (patchset #6 id:180001 of https://codereview.webrtc.org/1908623002/ )
Reason for revert:
There seems an error made in this patch.

Hi Henrik,

I think the bit shift returned by CrossCorrelationWithAutoShift may be wrongly used by DotProduct.

We'd better revert this CL.

Doing another fix (and future fixes) will be paintful. I will work on a easy-to-modify bitexactness test first.

Original issue's description:
> Avoiding overflow in cross correlation in NetEq.
>
> BUG=

TBR=henrik.lundin@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/1925053002
Cr-Commit-Position: refs/heads/master@{#12543}
2016-04-28 09:16:54 +00:00
minyue
3d09dfdbba Avoiding overflow in cross correlation in NetEq.
BUG=

Review-Url: https://codereview.webrtc.org/1908623002
Cr-Commit-Position: refs/heads/master@{#12538}
2016-04-27 22:06:18 +00:00
kwiberg
bfde543f73 Audio Coding Module: Use separate instances for 16 kHz and 32 kHz iSAC decoder
This will allow us to fix the sample rate of each AudioDecoder at
instantiation time.

This change results in different checksums for the following tests:

AcmReceiverBitExactnessOldApi.8kHzOutput
AcmReceiverBitExactnessOldApi.16kHzOutput
AcmReceiverBitExactnessOldApi.32kHzOutput
AcmReceiverBitExactnessOldApi.48kHzOutputExternalDecoder
AcmReceiverBitExactnessOldApi.48kHzOutput

Because they make an ACM and then ask it to decode both 16 kHz and 32
kHz iSAC. (The arm32 and arm64 checksums didn't change, because the
tests skip 32 kHz iSAC on arm.)

BUG=webrtc:5801

Review URL: https://codereview.webrtc.org/1908923002

Cr-Commit-Position: refs/heads/master@{#12463}
2016-04-22 07:32:06 +00:00
ossu
2903ba5ff3 Reland Remove the deprecated EncodeInternal interface from AudioEncoder
Remove the deprecated EncodeInternal interface from AudioEncoder

Also hid MaxEncodedBytes by making it private. It will get removed as soon as subclasses have had time to remove their overrides.

BUG=webrtc:5591

Review URL: https://codereview.webrtc.org/1881003003

Cr-Commit-Position: refs/heads/master@{#12409}
2016-04-18 13:14:42 +00:00
ossu
164bc4bbd3 Revert of Remove the deprecated EncodeInternal interface from AudioEncoder (patchset #4 id:60001 of https://codereview.webrtc.org/1864993002/ )
Reason for revert:
Broke import. Implementations of the old interface still exists somewhere.

Original issue's description:
> Remove the deprecated EncodeInternal interface from AudioEncoder
>
> Also hid MaxEncodedBytes by making it private. It will get removed as soon as subclasses have had time to remove their overrides.
>
> BUG=webrtc:5591
>
> Committed: https://crrev.com/5222d315dbea8f3563c100cc9f2451907f70b05f
> Cr-Commit-Position: refs/heads/master@{#12329}

TBR=kwiberg@webrtc.org,solenberg@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5591

Review URL: https://codereview.webrtc.org/1883543002

Cr-Commit-Position: refs/heads/master@{#12330}
2016-04-12 10:58:10 +00:00
ossu
5222d315db Remove the deprecated EncodeInternal interface from AudioEncoder
Also hid MaxEncodedBytes by making it private. It will get removed as soon as subclasses have had time to remove their overrides.

BUG=webrtc:5591

Review URL: https://codereview.webrtc.org/1864993002

Cr-Commit-Position: refs/heads/master@{#12329}
2016-04-12 10:31:03 +00:00
kwiberg
c8d071e4e0 Switch to using new ACM methods for encoder management
BUG=webrtc:5028

Review URL: https://codereview.webrtc.org/1677013002

Cr-Commit-Position: refs/heads/master@{#12267}
2016-04-06 19:22:45 +00:00
henrik.lundin
15c51e355f Move setting of AudioFrame::timestamp_ into NetEq
This was previously done in AcmReceiver, but belongs in NetEq where the
rest of the AudioFrame fields are populated.

BUG=webrtc:5669,webrtc:5607

Review URL: https://codereview.webrtc.org/1863993002

Cr-Commit-Position: refs/heads/master@{#12265}
2016-04-06 15:39:01 +00:00
henrik.lundin
9a410dd082 Change NetEq::GetPlayoutTimestamp to return an rtc::Optional<uint32_t>
This is in preparation for changes to when the playout timestamp is
valid.

BUG=webrtc:5669

Review URL: https://codereview.webrtc.org/1853183002

Cr-Commit-Position: refs/heads/master@{#12256}
2016-04-06 08:39:30 +00:00
henrik.lundin
7dc68897d3 Unit test for AudioFrame output from AcmReceiver::GetAudio
This new unit test verifies the parameter fields (not the audio data
itself) written to the AudioFrame output by AcmReceiver::GetAudio.

Also corrected a few comments reflecting recent changes in the code.

BUG=webrtc:5669

Review URL: https://codereview.webrtc.org/1859953002

Cr-Commit-Position: refs/heads/master@{#12253}
2016-04-06 08:03:07 +00:00
kwiberg
0d05da7ee6 Rent-A-Codec: Reference count the shared iSAC bandwidth estimation state
Now that the Rent-A-Codec no longer owns the encoders and decoders it
produces, they may outlive it. It's thus no longer correct for the
Rent-A-Codec to own the bandwidth estimation state; all of the
involved objects need to share ownership.

BUG=webrtc:5028

Review URL: https://codereview.webrtc.org/1821513003

Cr-Commit-Position: refs/heads/master@{#12159}
2016-03-30 11:10:18 +00:00
kwiberg
4cdbd57fe3 AudioCodingModule: Add methods for injecting external encoder stacks
BUG=webrtc:5028

Review URL: https://codereview.webrtc.org/1673213002

Cr-Commit-Position: refs/heads/master@{#12158}
2016-03-30 10:10:15 +00:00
kwiberg
22feaa3d15 Replace scoped_ptr with unique_ptr in webrtc/modules/
Except in places where this would break out-of-tree code,
such as Chromium.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1785173002

Cr-Commit-Position: refs/heads/master@{#12037}
2016-03-17 16:17:49 +00:00
henrik.lundin
b4855cc366 Delete file acm_neteq_unittest.cc
The file was essentially empty, and not used.

TBR=kwiberg@webrtc.org
NOTRY=true

Review URL: https://codereview.webrtc.org/1804303003

Cr-Commit-Position: refs/heads/master@{#12013}
2016-03-16 09:34:33 +00:00
Tommi
d44c077dce Revert of Safe numeric library: base/numerics (copied from Chromium) (patchset #11 id:250001 of https://codereview.webrtc.org/1753293002/ )
Reason for revert:
Looks like the Chrome iOS build is broken because of these two changes.  So I'm going to have to revert.  Here's the error:

https://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ninja/builds/185624/steps/compile/logs/stdio

FAILED: rm -f arch/libsafe_numerics.arm64.a && ./gyp-mac-tool filter-libtool libtool  -static -o arch/libsafe_numerics.arm64.a
error: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
FAILED: rm -f arch/libsafe_numerics.armv7.a && ./gyp-mac-tool filter-libtool libtool  -static -o arch/libsafe_numerics.armv7.a
error: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
ninja: build stopped: subcommand failed.

Original issue's description:
> Safe numeric library added: base/numerics (copied from Chromium)
>
> This copies the contents (unittest excluded) of base/numerics in
> chromium to base/numerics in webrtc. Files added:
> - safe_conversions.h
> - safe_conversions_impl.h
> - safe_math.h
> - safe_math_impl.h
>
> A really old version of safe_conversions[_impl].h previously existed in
> base/, this has been deleted and sources using it have been updated
> to include the new base/numerics/safe_converions.h.
>
> This CL also adds a DEPS file to webrtc/base.
>
> NOPRESUBMIT=True
> BUG=webrtc:5548, webrtc:5623
>
> Committed: https://crrev.com/de1c81b2d2196be611674aa6019b9db3a9329042
> Cr-Commit-Position: refs/heads/master@{#11907}

TBR=kjellander@webrtc.org,kwiberg@webrtc.org,tina.legrand@webrtc.org,hbos@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5548, webrtc:5623

Review URL: https://codereview.webrtc.org/1792613002 .

Cr-Commit-Position: refs/heads/master@{#11965}
2016-03-12 01:12:40 +00:00
kwiberg
6030a129c0 Pass ownership of external encoders to the ACM
We want this because otherwise the ACM uses its mutex to protect an
encoder that's owned by someone else. That someone else may easily
slip up and delete or otherwise touch the encoder before making sure
that the ACM has stopped using it, bypassing the lock.

BUG=webrtc:5028

Review URL: https://codereview.webrtc.org/1702943002

Cr-Commit-Position: refs/heads/master@{#11909}
2016-03-08 14:01:37 +00:00
hbos
de1c81b2d2 Safe numeric library added: base/numerics (copied from Chromium)
This copies the contents (unittest excluded) of base/numerics in
chromium to base/numerics in webrtc. Files added:
- safe_conversions.h
- safe_conversions_impl.h
- safe_math.h
- safe_math_impl.h

A really old version of safe_conversions[_impl].h previously existed in
base/, this has been deleted and sources using it have been updated
to include the new base/numerics/safe_converions.h.

This CL also adds a DEPS file to webrtc/base.

NOPRESUBMIT=True
BUG=webrtc:5548, webrtc:5623

Review URL: https://codereview.webrtc.org/1753293002

Cr-Commit-Position: refs/heads/master@{#11907}
2016-03-08 12:46:07 +00:00
henrik.lundin
55480f5efa Remove the type parameter to NetEq::GetAudio
The type is included in the AudioFrame output parameter.

Rename the type NetEqOutputType to just OutputType, since it is now
internal to NetEq.

BUG=webrtc:5607

Review URL: https://codereview.webrtc.org/1769883002

Cr-Commit-Position: refs/heads/master@{#11903}
2016-03-08 10:38:02 +00:00
henrik.lundin
500c04bc86 Delete VAD methods from AcmReceiver and move functionality inside NetEq
This change essentially does two things:

1. Remove the VAD-related methods from AcmReceiver. These are
EnableVad(), DisableVad(), and vad_enabled(). None of them were used
outside of unit tests.

2. Move the functionality to set AudioFrame::speech_type_ and
AudioFrame::vad_activity_ inside NetEq. This was previously done in
AcmReceiver, but based on information inherently owned by NetEq.

With the change in 2, NetEq's GetAudio interface can be simplified by
removing the output type parameter. This will be done in a follow-up
CL.

BUG=webrtc:5607

Review URL: https://codereview.webrtc.org/1772583002

Cr-Commit-Position: refs/heads/master@{#11902}
2016-03-08 10:36:07 +00:00
henrik.lundin
6d8e011b64 Change NetEq::GetAudio to use AudioFrame
With this change, NetEq now uses AudioFrame as output type, like the
surrounding functions in ACM and VoiceEngine already do.

The computational savings is probably slim, since one memcpy is
removed while another one is added (both in AcmReceiver::GetAudio).

More simplifications and clean-up will be done in
AcmReceiver::GetAudio in future CLs.

BUG=webrtc:5607

Review URL: https://codereview.webrtc.org/1750353002

Cr-Commit-Position: refs/heads/master@{#11874}
2016-03-04 18:34:26 +00:00
ossu
4f43fcfd49 Renamed new EncodeInternal to EncodeImpl to ensure proper backwards compatibility.
Renamed the new variant of EncodeInternal to EncodeImpl, so that
subclasses implementing one of the EncodeInternal don't need to
explicitly contain 'using AudioEncoder::EncodeInternal' to avoid their
implementation hiding the other variant of EncodeInternal. This causes
a warning (treated as an error) when building using GCC.

Review URL: https://codereview.webrtc.org/1764583003

Cr-Commit-Position: refs/heads/master@{#11868}
2016-03-04 08:54:38 +00:00
henrik.lundin
0023fdffd0 Remove the ID from AcmReceiver
This is an artifact from the past, and is no longer used.

R=ivoc@webrtc.org

Review URL: https://codereview.webrtc.org/1764623002

Cr-Commit-Position: refs/heads/master@{#11866}
2016-03-04 07:05:45 +00:00
ossu
10a029e952 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.

Review URL: https://codereview.webrtc.org/1725143003

Cr-Commit-Position: refs/heads/master@{#11823}
2016-03-01 08:41:39 +00:00
kwiberg
16c5a96630 Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/
BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1694073002

Cr-Commit-Position: refs/heads/master@{#11622}
2016-02-15 10:27:34 +00:00
henrik.lundin
6608d9a1aa NetEq: Fix a negative shift value
In some rare occations (very low energy signal), a shift value happened
to be negative. This is now fixed by using the WEBRTC_SPL_SHIFT_W32,
which in essence checks the sign of the number of shifts and performs a
right or left shift accordingly.

The fix reverts to how the code was written in old NetEq; see
4d363ae305/webrtc/modules/audio_coding/neteq/normal.c (165).

BUG=webrtc:5490

Review URL: https://codereview.webrtc.org/1675293002

Cr-Commit-Position: refs/heads/master@{#11546}
2016-02-10 10:47:56 +00:00
kjellander
c3a0983d4b Roll chromium_revision a8e5140..c6076f2 (372922:372974) incl. update to Opus v.1.1.2
Includes updates to tests for Opus v.1.1.2, reveiwed in
https://codereview.webrtc.org/1629413002/

Change log: a8e5140..c6076f2
Full diff: a8e5140..c6076f2

Changed dependencies:
* src/third_party/catapult: 471db30..d4d48e6
* src/third_party/opus/src: cae6961..655cc54
DEPS diff: a8e5140..c6076f2/DEPS

No update to Clang.

BUG=chromium:580524
TBR=

Review URL: https://codereview.webrtc.org/1657343002

Cr-Commit-Position: refs/heads/master@{#11464}
2016-02-02 21:18:42 +00:00
kwiberg
83277131b1 AudioCodingModuleImpl: Put CodecManager and Rent-A-Codec in a separate struct
This will make it easier for future CLs to make them optional.

BUG=webrtc:5028

Review URL: https://codereview.webrtc.org/1625363002

Cr-Commit-Position: refs/heads/master@{#11381}
2016-01-26 14:06:20 +00:00
kwiberg
6a07f12e95 AudioCodingModuleImpl: Initialize encoder_stack_ to nullptr
This should have been done in commit 11340, but it was left out by
mistake.

BUG=webrtc:5028

Review URL: https://codereview.webrtc.org/1631443002

Cr-Commit-Position: refs/heads/master@{#11378}
2016-01-26 11:28:57 +00:00
pbos
5ad935cb56 Remove mutable from rtc::CriticalSection members.
rtc::CriticalSection is now lockable from const methods and no longer
need to remain mutable.

BUG=
R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1613643004

Cr-Commit-Position: refs/heads/master@{#11367}
2016-01-25 11:52:53 +00:00