42 Commits

Author SHA1 Message Date
henrika
f502222443 - Adds thread safety annotations to the AudioDeviceBuffer class.
- Removes the lock that was used to protect the audio transport object.
  It is now protected "by design" instead.
- Removes rec/play_bytes_per_sample_ since we only support 16-bit samples.

BUG=webrtc:6560
R=kwiberg@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#14950}
2016-11-07 14:57:11 +00:00
henrika
ba156cfe96 Improvements in how WebRTC.Audio.RecordedOnlyZeros is added as histogram.
Contains fixes for a non-perfect implementation in https://codereview.webrtc.org/2328433003/

Summary:

Adds WebRTC.Audio.RecordedOnlyZeros UMA stat when recording stops if:
- All level estimates during the audio session were zero, and
- If the audio session was longer than 10 seconds.

Adds four simple methods to the AudioDeviceBuffer (ADB) class to allow the ADM
to update the ADB about when media starts and stops in both directions.

Moves any "critical" parst out frome the timer (based on task queue) and ensures
that it only does trivial logging tasks.

The task queue is now owned by a unique pointer to improve control of when it
starts and stops.

Adds time measurements (for logging) of both total time playing out and total
recording time. Units are in milliseconds.

BUG=webrtc:6592

Review-Url: https://codereview.webrtc.org/2445363003
Cr-Commit-Position: refs/heads/master@{#14854}
2016-10-31 15:18:54 +00:00
henrika
3355f6d6f5 Avoids invalid copy of audio buffer to task queue.
Now does level estimate on the audio threads to avoid complex
copying of audio data to task queue. The old implementation could
also crash due to unclear ownership of the audio buffer.

BUG=webrtc:6569
R=kwiberg@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#14720}
2016-10-21 10:45:31 +00:00
henrika
5588a13fe7 Now uses rtc::Buffer in AudioDeviceBuffer.
The main goal of this CL is to remove old buffer handling using static arrays
and switch to the improved rtc::Buffer class instead.

By doing so, we can remove some members (since Buffer maintains them instead) and
do some additional cleanup.

This CL also fixes some minor style issues and improves the locking mechanism.

Finally, AudioDeviceBuffer::SetRecordingChannel() is deprecated since it has never been
used and is not included in any test.

BUG=NONE

Review-Url: https://codereview.webrtc.org/2333273002
Cr-Commit-Position: refs/heads/master@{#14661}
2016-10-18 12:14:35 +00:00
henrika
a6d26ec6a2 Improves resolution when logging rate in the ADB class.
Trivial patch which fixes an issue where logged rate estimates could be
invalid. E.g. on iOS, two successive timer interrupts can be ~10.5 seconds
and not exactly 10.0 (which is usually the case on Android). In those
cases we could log a rate estimate of e.g. ~51000Hz instead of ~48000Hz.

This CL fixes that.

BUG=NONE

Review-Url: https://codereview.webrtc.org/2350103002
Cr-Commit-Position: refs/heads/master@{#14305}
2016-09-20 11:44:12 +00:00
henrika
918b554789 Adds support for OpenSL ES based audio capture on Android.
NOTE: the new code is disabled by default in the WebRtcAudioManager to ensure that
OpenSL ES is not accidentally activated in existing clients. There are still some
unresolved issues to sort out before it can be utilized.

Enables possibility to use OpenSL ES based audio in both directions for WebRTC.
All unit tests and demo clients have been tested with the new implementation but
the new support is behind a flag (see above).

More testing is needed before it can be used in the field and additional support for
hardware effects is still missing.

BUG=webrtc:5925
R=tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#14290}
2016-09-19 13:44:22 +00:00
asapersson
1d02d3e5e6 Remove RTC_LOGGED_* macro.
BUG=

Review-Url: https://codereview.webrtc.org/2326843003
Cr-Commit-Position: refs/heads/master@{#14174}
2016-09-10 05:40:34 +00:00
henrika
f06f35a161 Adds logging of native audio levels and UMA stats to track issues.
This changes added a simple measurement of levels "close to the audio hardware"
both for playout and for recording. These levels are logged once each 10 seconds.

It also adds WebRTC.Audio.RecordedOnlyZeros UMA stat and it is updated at
destuction. It will report true iff all reported recording leves are zero.

BUG=NONE
R=peah@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#14160}
2016-09-09 12:23:24 +00:00
henrika
073378e79a Avoids crash at device switch on iOS by ensuring that audio parameters can be updated on the fly driven by e.g. switching audio device.
R=henrikg@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#14158}
2016-09-09 11:15:49 +00:00
henrika
49810511c9 [Reland] Cleanup of the AudioDeviceBuffer class.
See https://codereview.webrtc.org/2256833003/

Contains a minor change to ensure that an external client builds.

TBR=magjed
BUG=NONE

Review-Url: https://codereview.webrtc.org/2269553004
Cr-Commit-Position: refs/heads/master@{#13845}
2016-08-22 12:56:17 +00:00
henrika
d7a89dbe8b Revert of Cleanup of the AudioDeviceBuffer class (patchset #6 id:100001 of https://codereview.webrtc.org/2256833003/ )
Reason for revert:
Seems to break an external client.

Original issue's description:
> Cleanup of the AudioDeviceBuffer class.
>
> WebRTC works on 10ms buffer sizes in both directions but this class has contained
> support for any size (with some limits) and for changes on the fly. It makes no sense to maintain such code and we have no tests to test it. This CL ensures that only 10ms audio buffers are supported and that nothing can be changed on the fly.
>
> It also updates the style to follow the Google C++ style guide.
>
> Finally, I remove very old (not tested and not maintained) support for file
> handling since the code is never used. It was more or less dead code.
>
> BUG=NONE
> R=magjed@webrtc.org
>
> Committed: https://crrev.com/cf327b45b9f5738950d4fca2b6a7b6030d508cdf
> Cr-Commit-Position: refs/heads/master@{#13833}

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

Review-Url: https://codereview.webrtc.org/2260183002
Cr-Commit-Position: refs/heads/master@{#13834}
2016-08-19 15:09:29 +00:00
henrika
cf327b45b9 Cleanup of the AudioDeviceBuffer class.
WebRTC works on 10ms buffer sizes in both directions but this class has contained
support for any size (with some limits) and for changes on the fly. It makes no sense to maintain such code and we have no tests to test it. This CL ensures that only 10ms audio buffers are supported and that nothing can be changed on the fly.

It also updates the style to follow the Google C++ style guide.

Finally, I remove very old (not tested and not maintained) support for file
handling since the code is never used. It was more or less dead code.

BUG=NONE
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13833}
2016-08-19 14:38:07 +00:00
henrika
3d7346fd46 Adds delta-time logging for audio playout
BUG=NONE
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13576}
2016-07-29 14:21:41 +00:00
henrika
6c4d0f0bbf Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2148623004/ )
Reason for revert:
New fixes in libevent indicates that we are OK and can reland again.

Original issue's description:
> Revert of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2146853003/ )
>
> Reason for revert:
> Looks like things are still breaking upstream... :(
>
> Original issue's description:
> > Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2141413002/ )
> >
> > Reason for revert:
> > Will make one more try since we have now confirmed that our TaskQueue tests works on Android. Let's hope for the best...
> >
> > Original issue's description:
> > > Revert of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2138403003/ )
> > >
> > > Reason for revert:
> > > Reverting again since it might have caused this issue:
> > >
> > > https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/13622/steps/content_browsertests/logs/stdio
> > >
> > > Original issue's description:
> > > > Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2139233002/ )
> > > >
> > > > Reason for revert:
> > > > My original patch broke things that are now fixed by https://codereview.webrtc.org/2141193002/.
> > > >
> > > > Hence I am relanding my original change.
> > > >
> > > > Original issue's description:
> > > > > Revert of Adds data logging in native AudioDeviceBuffer class (patchset #10 id:180001 of https://codereview.webrtc.org/2132613002/ )
> > > > >
> > > > > Reason for revert:
> > > > > Seems to break things upstream.
> > > > >
> > > > > Original issue's description:
> > > > > > Adds data logging in native AudioDeviceBuffer class.
> > > > > >
> > > > > > Goal is to provide periodic logging of most essential audio parameters
> > > > > > for playout and recording sides. It will allow us to track if the native audio layer is working as intended.
> > > > > >
> > > > > > BUG=NONE
> > > > > >
> > > > > > Committed: https://crrev.com/348e411dd27e6dbe9b84b27ce46e9b7c657c1eae
> > > > > > Cr-Commit-Position: refs/heads/master@{#13440}
> > > > >
> > > > > TBR=stefan@webrtc.org,henrika@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=NONE
> > > > >
> > > > > Committed: https://crrev.com/025aa94ccb85e4c6fe20a3fecdac5d27ec9ba3da
> > > > > Cr-Commit-Position: refs/heads/master@{#13441}
> > > >
> > > > TBR=stefan@webrtc.org,sprang@webrtc.org
> > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > NOPRESUBMIT=true
> > > > NOTREECHECKS=true
> > > > NOTRY=true
> > > > BUG=NONE
> > > >
> > > > Committed: https://crrev.com/dd2fdecc78c50377d10ec98b41179acde9218ee7
> > > > Cr-Commit-Position: refs/heads/master@{#13455}
> > >
> > > TBR=stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=NONE
> > >
> > > Committed: https://crrev.com/5dd941e5a5ccde541d9b40a1df379ed59c5fab5c
> > > Cr-Commit-Position: refs/heads/master@{#13457}
> >
> > TBR=stefan@webrtc.org,sprang@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=NONE
> >
> > Committed: https://crrev.com/b201da3fab5efc048a4341f39293d2dcf27b2eec
> > Cr-Commit-Position: refs/heads/master@{#13462}
>
> TBR=stefan@webrtc.org,henrika@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=NONE
>
> Committed: https://crrev.com/ac09501381575dcb07560effc45ec7263d3ff3ad
> Cr-Commit-Position: refs/heads/master@{#13464}

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

Review-Url: https://codereview.webrtc.org/2148243002
Cr-Commit-Position: refs/heads/master@{#13476}
2016-07-14 12:54:24 +00:00
sprang
ac09501381 Revert of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2146853003/ )
Reason for revert:
Looks like things are still breaking upstream... :(

Original issue's description:
> Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2141413002/ )
>
> Reason for revert:
> Will make one more try since we have now confirmed that our TaskQueue tests works on Android. Let's hope for the best...
>
> Original issue's description:
> > Revert of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2138403003/ )
> >
> > Reason for revert:
> > Reverting again since it might have caused this issue:
> >
> > https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/13622/steps/content_browsertests/logs/stdio
> >
> > Original issue's description:
> > > Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2139233002/ )
> > >
> > > Reason for revert:
> > > My original patch broke things that are now fixed by https://codereview.webrtc.org/2141193002/.
> > >
> > > Hence I am relanding my original change.
> > >
> > > Original issue's description:
> > > > Revert of Adds data logging in native AudioDeviceBuffer class (patchset #10 id:180001 of https://codereview.webrtc.org/2132613002/ )
> > > >
> > > > Reason for revert:
> > > > Seems to break things upstream.
> > > >
> > > > Original issue's description:
> > > > > Adds data logging in native AudioDeviceBuffer class.
> > > > >
> > > > > Goal is to provide periodic logging of most essential audio parameters
> > > > > for playout and recording sides. It will allow us to track if the native audio layer is working as intended.
> > > > >
> > > > > BUG=NONE
> > > > >
> > > > > Committed: https://crrev.com/348e411dd27e6dbe9b84b27ce46e9b7c657c1eae
> > > > > Cr-Commit-Position: refs/heads/master@{#13440}
> > > >
> > > > TBR=stefan@webrtc.org,henrika@webrtc.org
> > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > NOPRESUBMIT=true
> > > > NOTREECHECKS=true
> > > > NOTRY=true
> > > > BUG=NONE
> > > >
> > > > Committed: https://crrev.com/025aa94ccb85e4c6fe20a3fecdac5d27ec9ba3da
> > > > Cr-Commit-Position: refs/heads/master@{#13441}
> > >
> > > TBR=stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=NONE
> > >
> > > Committed: https://crrev.com/dd2fdecc78c50377d10ec98b41179acde9218ee7
> > > Cr-Commit-Position: refs/heads/master@{#13455}
> >
> > TBR=stefan@webrtc.org,sprang@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=NONE
> >
> > Committed: https://crrev.com/5dd941e5a5ccde541d9b40a1df379ed59c5fab5c
> > Cr-Commit-Position: refs/heads/master@{#13457}
>
> TBR=stefan@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=NONE
>
> Committed: https://crrev.com/b201da3fab5efc048a4341f39293d2dcf27b2eec
> Cr-Commit-Position: refs/heads/master@{#13462}

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

Review-Url: https://codereview.webrtc.org/2148623004
Cr-Commit-Position: refs/heads/master@{#13464}
2016-07-13 14:55:52 +00:00
henrika
b201da3fab Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2141413002/ )
Reason for revert:
Will make one more try since we have now confirmed that our TaskQueue tests works on Android. Let's hope for the best...

Original issue's description:
> Revert of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2138403003/ )
>
> Reason for revert:
> Reverting again since it might have caused this issue:
>
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/13622/steps/content_browsertests/logs/stdio
>
> Original issue's description:
> > Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2139233002/ )
> >
> > Reason for revert:
> > My original patch broke things that are now fixed by https://codereview.webrtc.org/2141193002/.
> >
> > Hence I am relanding my original change.
> >
> > Original issue's description:
> > > Revert of Adds data logging in native AudioDeviceBuffer class (patchset #10 id:180001 of https://codereview.webrtc.org/2132613002/ )
> > >
> > > Reason for revert:
> > > Seems to break things upstream.
> > >
> > > Original issue's description:
> > > > Adds data logging in native AudioDeviceBuffer class.
> > > >
> > > > Goal is to provide periodic logging of most essential audio parameters
> > > > for playout and recording sides. It will allow us to track if the native audio layer is working as intended.
> > > >
> > > > BUG=NONE
> > > >
> > > > Committed: https://crrev.com/348e411dd27e6dbe9b84b27ce46e9b7c657c1eae
> > > > Cr-Commit-Position: refs/heads/master@{#13440}
> > >
> > > TBR=stefan@webrtc.org,henrika@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=NONE
> > >
> > > Committed: https://crrev.com/025aa94ccb85e4c6fe20a3fecdac5d27ec9ba3da
> > > Cr-Commit-Position: refs/heads/master@{#13441}
> >
> > TBR=stefan@webrtc.org,sprang@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=NONE
> >
> > Committed: https://crrev.com/dd2fdecc78c50377d10ec98b41179acde9218ee7
> > Cr-Commit-Position: refs/heads/master@{#13455}
>
> TBR=stefan@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=NONE
>
> Committed: https://crrev.com/5dd941e5a5ccde541d9b40a1df379ed59c5fab5c
> Cr-Commit-Position: refs/heads/master@{#13457}

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

Review-Url: https://codereview.webrtc.org/2146853003
Cr-Commit-Position: refs/heads/master@{#13462}
2016-07-13 13:40:25 +00:00
henrika
5dd941e5a5 Revert of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2138403003/ )
Reason for revert:
Reverting again since it might have caused this issue:

https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/13622/steps/content_browsertests/logs/stdio

Original issue's description:
> Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2139233002/ )
>
> Reason for revert:
> My original patch broke things that are now fixed by https://codereview.webrtc.org/2141193002/.
>
> Hence I am relanding my original change.
>
> Original issue's description:
> > Revert of Adds data logging in native AudioDeviceBuffer class (patchset #10 id:180001 of https://codereview.webrtc.org/2132613002/ )
> >
> > Reason for revert:
> > Seems to break things upstream.
> >
> > Original issue's description:
> > > Adds data logging in native AudioDeviceBuffer class.
> > >
> > > Goal is to provide periodic logging of most essential audio parameters
> > > for playout and recording sides. It will allow us to track if the native audio layer is working as intended.
> > >
> > > BUG=NONE
> > >
> > > Committed: https://crrev.com/348e411dd27e6dbe9b84b27ce46e9b7c657c1eae
> > > Cr-Commit-Position: refs/heads/master@{#13440}
> >
> > TBR=stefan@webrtc.org,henrika@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=NONE
> >
> > Committed: https://crrev.com/025aa94ccb85e4c6fe20a3fecdac5d27ec9ba3da
> > Cr-Commit-Position: refs/heads/master@{#13441}
>
> TBR=stefan@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=NONE
>
> Committed: https://crrev.com/dd2fdecc78c50377d10ec98b41179acde9218ee7
> Cr-Commit-Position: refs/heads/master@{#13455}

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

Review-Url: https://codereview.webrtc.org/2141413002
Cr-Commit-Position: refs/heads/master@{#13457}
2016-07-13 09:32:45 +00:00
henrika
dd2fdecc78 Reland of Adds data logging in native AudioDeviceBuffer class (patchset #1 id:1 of https://codereview.webrtc.org/2139233002/ )
Reason for revert:
My original patch broke things that are now fixed by https://codereview.webrtc.org/2141193002/.

Hence I am relanding my original change.

Original issue's description:
> Revert of Adds data logging in native AudioDeviceBuffer class (patchset #10 id:180001 of https://codereview.webrtc.org/2132613002/ )
>
> Reason for revert:
> Seems to break things upstream.
>
> Original issue's description:
> > Adds data logging in native AudioDeviceBuffer class.
> >
> > Goal is to provide periodic logging of most essential audio parameters
> > for playout and recording sides. It will allow us to track if the native audio layer is working as intended.
> >
> > BUG=NONE
> >
> > Committed: https://crrev.com/348e411dd27e6dbe9b84b27ce46e9b7c657c1eae
> > Cr-Commit-Position: refs/heads/master@{#13440}
>
> TBR=stefan@webrtc.org,henrika@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=NONE
>
> Committed: https://crrev.com/025aa94ccb85e4c6fe20a3fecdac5d27ec9ba3da
> Cr-Commit-Position: refs/heads/master@{#13441}

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

Review-Url: https://codereview.webrtc.org/2138403003
Cr-Commit-Position: refs/heads/master@{#13455}
2016-07-13 08:49:02 +00:00
sprang
025aa94ccb Revert of Adds data logging in native AudioDeviceBuffer class (patchset #10 id:180001 of https://codereview.webrtc.org/2132613002/ )
Reason for revert:
Seems to break things upstream.

Original issue's description:
> Adds data logging in native AudioDeviceBuffer class.
>
> Goal is to provide periodic logging of most essential audio parameters
> for playout and recording sides. It will allow us to track if the native audio layer is working as intended.
>
> BUG=NONE
>
> Committed: https://crrev.com/348e411dd27e6dbe9b84b27ce46e9b7c657c1eae
> Cr-Commit-Position: refs/heads/master@{#13440}

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

Review-Url: https://codereview.webrtc.org/2139233002
Cr-Commit-Position: refs/heads/master@{#13441}
2016-07-12 10:08:51 +00:00
henrika
348e411dd2 Adds data logging in native AudioDeviceBuffer class.
Goal is to provide periodic logging of most essential audio parameters
for playout and recording sides. It will allow us to track if the native audio layer is working as intended.

BUG=NONE

Review-Url: https://codereview.webrtc.org/2132613002
Cr-Commit-Position: refs/heads/master@{#13440}
2016-07-12 09:18:46 +00:00
henrika
3f33e2aa54 Minor refactoring of the AudioDeviceBuffer class
BUG=NONE
NOTRY=true

Review-Url: https://codereview.webrtc.org/2117303002
Cr-Commit-Position: refs/heads/master@{#13389}
2016-07-06 07:34:02 +00:00
henrika
0fd6801c3c clang-format on AudioDeviceBuffer
BUG=NONE
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13377}
2016-07-04 11:01:41 +00:00
tommi
a6219cc3ef FileWrapper[Impl] modifications and actually remove the "Impl" class.
This is a somewhat involved refactoring of this class. Here's an overview of the changes:

* FileWrapper can now be used as a regular class and instances allocated on the stack.
* The type now has support for move semantics and copy isn't allowed.
* New public ctor with FILE* that can be used instead of OpenFromFileHandle.
* New static Open() method.  The intent of this is to allow opening a file and getting back a FileWrapper instance.  Using this method instead of Create(), will allow us in the future to make the FILE* member pointer, to be const and simplify threading (get rid of the lock).
* Rename the Open() method to is_open() and make it inline.
* The FileWrapper interface is no longer a pure virtual interface.  There's only one implementation so there's no need to go through a vtable for everything.
* Functionality offered by the class, is now reduced.  No support for looping (not clear if that was actually useful to users of that flag), no need to implement the 'read_only_' functionality in the class, since file APIs implement that already, no support for *not* managing the file handle (this wasn't used).  OpenFromFileHandle always "manages" the file.
* Delete the unused WriteText() method and don't support opening files in text mode.  Text mode is only different on Windows and on Windows it translates \n to \r\n, which means that files such as log files, could have a slightly different format on Windows than other platforms.  Besides, tools on Windows can handle UNIX line endings.
* Remove FileName(), change Trace code to manage its own path.
* Rename id_ member variable to file_.
* Removed the open_ member variable since the same functionality can be gotten from just checking the file pointer.
* Don't call CloseFile inside of Write.  Write shouldn't be changing the state of the class beyond just attempting to write.
* Remove concept of looping from FileWrapper and never close inside of Read()
* Changed stream base classes to inherit from a common base class instead of both defining the Rewind method. Ultimately, Id' like to remove these interfaces and just have FileWrapper.
* Remove read_only param from OpenFromFileHandle
* Renamed size_in_bytes_ to position_, since it gets set to 0 when Rewind() is called (and the size actually does not change).
* Switch out rw lock for CriticalSection. The r/w lock was only used for reading when checking the open_ flag.

BUG=

Review-Url: https://codereview.webrtc.org/2054373002
Cr-Commit-Position: refs/heads/master@{#13155}
2016-06-15 17:30:18 +00:00
Peter Kasting
6955870806 Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.

BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-13 00:26:55 +00:00
Henrik Kjellander
98f53510b2 system_wrappers: rename interface -> include
BUG=webrtc:5095
R=tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10438}
2015-10-28 17:17:50 +00:00
Peter Kasting
dce40cf804 Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.

This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.

This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002

The change is being landed as TBR to all the folks who reviewed the above.

BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher

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

Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 21:52:45 +00:00
henrika
ba35d05a49 Cleanup of iOS AudioDevice implementation
TBR=tkchin
BUG=webrtc:4789
TEST=modules_unittests --gtest_filter=AudioDeviceTest* and AppRTCDemo

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

Cr-Commit-Position: refs/heads/master@{#9578}
2015-07-14 15:04:19 +00:00
Peter Kasting
728d9037c0 Reformat existing code. There should be no functional effects.
This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)

BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9420}
2015-06-11 21:31:48 +00:00
Peter Kasting
b7e5054414 Match existing type usage better.
This makes a variety of small changes to synchronize bits of code using different types, remove useless code or casts, and add explicit casts in some places previously doing implicit ones.  For example:

* Change a few type declarations to better match how the majority of code uses those objects.
* Eliminate "< 0" check for unsigned values.
* Replace "(float)sin(x)", where |x| is also a float, with "sinf(x)", and similar.
* Add casts to uint32_t in many places timestamps were used and the existing code stored signed values into the unsigned objects.
* Remove downcasts when the results would be passed to a larger type, e.g. calling "foo((int16_t)x)" with an int |x| when foo() takes an int instead of an int16_t.
* Similarly, add casts when passing a larger type to a function taking a smaller one.
* Add casts to int16_t when doing something like "int16_t = int16_t + int16_t" as the "+" operation would implicitly upconvert to int, and similar.
* Use "false" instead of "0" for setting a bool.
* Shift a few temp types when doing a multi-stage calculation involving typecasts, so as to put the most logical/semantically correct type possible into the temps.  For example, when doing "int foo = int + int; size_t bar = (size_t)foo + size_t;", we might change |foo| to a size_t and move the cast if it makes more sense for |foo| to be represented as a size_t.

BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kwiberg@webrtc.org
TBR=andrew, asapersson, henrika

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

Cr-Commit-Position: refs/heads/master@{#9419}
2015-06-11 19:56:03 +00:00
Tommi
68898a2652 Remove AudioDeviceUtility.
The class doesn't do anything in almost all cases except for grabbing and releasing locks + allocate memory.  There are a couple of methods there such as WaitForKey and GetTimeInMs that are used, but those methods aren't specific to audio and we have implementations of these elsewhere.  The third method, StringCompare isn't used anywhere (and also isn't specific to audio).

BUG=
R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/50009004

Cr-Commit-Position: refs/heads/master@{#9220}
2015-05-19 15:27:50 +00:00
wu@webrtc.org
94454b71ad Fix the chain that propagates the audio frame's rtp and ntp timestamp including:
* In AudioCodingModuleImpl::PlayoutData10Ms, don't reset the timestamp got from GetAudio.
* When there're more than one participant, set AudioFrame's RTP timestamp to 0.
* Copy ntp_time_ms_ in AudioFrame::CopyFrom method.
* In RemixAndResample, pass src frame's timestamp_ and ntp_time_ms_ to the dst frame.
* Fix how |elapsed_time_ms| is computed in channel.cc by adding GetPlayoutFrequency.

Tweaks on ntp_time_ms_:
* Init ntp_time_ms_ to -1 in AudioFrame ctor.
* When there're more than one participant, set AudioFrame's ntp_time_ms_ to an invalid value. I.e. we don't support ntp_time_ms_ in multiple participants case before the mixing is moved to chrome.

Added elapsed_time_ms to AudioFrame and pass it to chrome, where we don't have the information about the rtp timestmp's sample rate, i.e. can't convert rtp timestamp to ms.

BUG=3111
R=henrik.lundin@webrtc.org, turaj@webrtc.org, xians@webrtc.org
TBR=andrew
andrew to take another look on audio_conference_mixer_impl.cc

Review URL: https://webrtc-codereview.appspot.com/14559004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6346 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-06-05 20:34:08 +00:00
wu@webrtc.org
cb711f77d2 Add interface to propagate audio capture timestamp to the renderer.
BUG=3111
R=andrew@webrtc.org, turaj@webrtc.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12239004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6189 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-19 17:39:11 +00:00
andrew@webrtc.org
2553450959 Fix win trybot errors due to r4729.
The addition of logging.h in r4729 was causing the win trybot to fail
with "#pragma deprecated" errors in standard library headers. This
turned out to be due to including strsafe.h (via audio_device_config.h)
before sstream (via logging.h).

strsafe.h was only being included for the unused DEBUG_PRINT macro. I
removed all references to it.

This incidentally removes a bunch of other unneeded headers discovered
while trying to track the problem down.

This didn't show up in the commitbots; my guess is that the trybots are
using the VC10 toolchain and the commitbots the VC11 toolchain.

TBR=pbos

Review URL: https://webrtc-codereview.appspot.com/2204004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4738 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-09-13 00:02:13 +00:00
andrew@webrtc.org
5eb997a2fd Fix unsigned/signed comparison error due to r4729.
Fix it for real by switching to ints rather than casting.

TBR=xians

Review URL: https://webrtc-codereview.appspot.com/2191009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4730 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-09-12 01:01:42 +00:00
andrew@webrtc.org
8f94013651 Reduce frequency of high audio delay warning logs.
This will log the warning every 5 seconds instead of every 10 ms.

BUG=b/10674993
TESTED=Ran voe_cmd_test with hard-coded high delay. Observed a log
every 5 seconds.

R=noahric@chromium.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2184009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4729 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-09-11 22:35:00 +00:00
pbos@webrtc.org
12dc1a38ca Switch C++-style C headers with their C equivalents.
The C++ headers define the C functions within the std:: namespace, but
we mainly don't use the std:: namespace for C functions. Therefore we
should include the C headers.

BUG=1833
R=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1917004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4486 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-08-05 16:22:53 +00:00
pbos@webrtc.org
811269df40 Include files from webrtc/.. paths in audio_device/.
BUG=1662
R=xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1785005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4330 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-07-11 13:24:38 +00:00
niklas.enbom@webrtc.org
3be565b502 Refactoring for typing detection
R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1370004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3976 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-05-07 21:04:24 +00:00
xians@webrtc.org
233c58de47 Landing 1399004, Minor clean up on the un-used _measureDelay code
Those code is/will never used, removing it makes the code better.



git-svn-id: http://webrtc.googlecode.com/svn/trunk@3961 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-05-06 11:52:47 +00:00
pbos@webrtc.org
2550988baa WebRtc_Word32 -> int32_t in audio_device/
BUG=314

Review URL: https://webrtc-codereview.appspot.com/1302006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3793 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-04-09 10:30:35 +00:00
henrika@webrtc.org
19da719a5f Resolves TSan v2 reports data races in voe_auto_test.
--- Note that I will add more fixes to this CL ---

BUG=1590

Review URL: https://webrtc-codereview.appspot.com/1286005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3770 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-04-05 14:34:57 +00:00
andrew@webrtc.org
14b43beb7c Move src/ -> webrtc/
TBR=niklas.enbom@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/915006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2963 4adac7df-926f-26a2-2b94-8c16560cd09d
2012-10-22 18:19:23 +00:00