summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndroid Chromium Automerger <chromium-automerger@android>2014-06-25 15:04:30 +0000
committerAndroid Chromium Automerger <chromium-automerger@android>2014-06-25 15:04:30 +0000
commit4c21d3a8817eb02f39b986c257f171da3166ecfc (patch)
treedac148172d6ee1d7359938e530741be884b1b1eb /modules
parentb0cf5e180c1851aaa78ea6a20830e650970ab732 (diff)
parentc34b9e5d5cd44c31c4f9da649b71d0d3132cf516 (diff)
downloadwebrtc-4c21d3a8817eb02f39b986c257f171da3166ecfc.tar.gz
Merge third_party/webrtc from https://chromium.googlesource.com/external/webrtc/trunk/webrtc.git at c34b9e5d5cd44c31c4f9da649b71d0d3132cf516
This commit was generated by merge_from_chromium.py. Change-Id: Ibdea97e7e6e800b2b7d7d3122a1d77e467cfbde4
Diffstat (limited to 'modules')
-rw-r--r--modules/audio_coding/BUILD.gn13
-rw-r--r--modules/audio_coding/OWNERS1
-rw-r--r--modules/audio_coding/main/acm2/acm_cng.h3
-rw-r--r--modules/audio_coding/main/acm2/acm_g722.h7
-rw-r--r--modules/audio_coding/main/acm2/acm_generic_codec.cc5
-rw-r--r--modules/audio_coding/main/acm2/acm_generic_codec.h87
-rw-r--r--modules/audio_coding/main/acm2/acm_ilbc.h10
-rw-r--r--modules/audio_coding/main/acm2/acm_isac.cc6
-rw-r--r--modules/audio_coding/main/acm2/acm_isac.h20
-rw-r--r--modules/audio_coding/main/acm2/acm_opus.h7
-rw-r--r--modules/audio_coding/main/acm2/acm_pcm16b.h7
-rw-r--r--modules/audio_coding/main/acm2/acm_pcma.h4
-rw-r--r--modules/audio_coding/main/acm2/acm_pcmu.h7
-rw-r--r--modules/audio_coding/main/acm2/acm_receiver.cc59
-rw-r--r--modules/audio_coding/main/acm2/acm_receiver.h9
-rw-r--r--modules/audio_coding/main/acm2/audio_coding_module_impl.cc5
-rw-r--r--modules/audio_coding/main/acm2/audio_coding_module_impl.h20
-rw-r--r--modules/audio_coding/main/interface/audio_coding_module.h1
-rw-r--r--modules/audio_coding/neteq/tools/neteq_rtpplay.cc1
-rw-r--r--modules/audio_conference_mixer/BUILD.gn41
-rw-r--r--modules/audio_conference_mixer/OWNERS4
-rw-r--r--modules/audio_device/BUILD.gn13
-rw-r--r--modules/audio_device/OWNERS2
-rw-r--r--modules/audio_processing/BUILD.gn13
-rw-r--r--modules/audio_processing/OWNERS2
-rw-r--r--modules/audio_processing/aec/aec_core_neon.c99
-rw-r--r--modules/audio_processing/aec/aec_core_sse2.c4
-rw-r--r--modules/audio_processing/aec/system_delay_unittest.cc7
-rw-r--r--modules/bitrate_controller/BUILD.gn28
-rw-r--r--modules/bitrate_controller/OWNERS2
-rw-r--r--modules/desktop_capture/BUILD.gn19
-rw-r--r--modules/desktop_capture/OWNERS2
-rw-r--r--modules/desktop_capture/win/screen_capturer_win_gdi.cc8
-rw-r--r--modules/media_file/BUILD.gn41
-rw-r--r--modules/media_file/OWNERS4
-rw-r--r--modules/pacing/BUILD.gn16
-rw-r--r--modules/pacing/OWNERS2
-rw-r--r--modules/remote_bitrate_estimator/BUILD.gn17
-rw-r--r--modules/remote_bitrate_estimator/OWNERS3
-rw-r--r--modules/rtp_rtcp/BUILD.gn104
-rw-r--r--modules/rtp_rtcp/OWNERS4
-rw-r--r--modules/utility/BUILD.gn48
-rw-r--r--modules/utility/OWNERS4
-rw-r--r--modules/video_capture/BUILD.gn13
-rw-r--r--modules/video_capture/OWNERS2
-rw-r--r--modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java78
-rw-r--r--modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java7
-rw-r--r--modules/video_capture/android/video_capture_android.cc13
-rw-r--r--modules/video_coding/BUILD.gn86
-rw-r--r--modules/video_coding/OWNERS2
-rw-r--r--modules/video_processing/BUILD.gn13
-rw-r--r--modules/video_processing/OWNERS1
-rw-r--r--modules/video_render/BUILD.gn13
-rw-r--r--modules/video_render/OWNERS2
54 files changed, 821 insertions, 168 deletions
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
new file mode 100644
index 00000000..e4ad4cb3
--- /dev/null
+++ b/modules/audio_coding/BUILD.gn
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("audio_coding") {
+ # TODO(andrew): Implement.
+}
diff --git a/modules/audio_coding/OWNERS b/modules/audio_coding/OWNERS
new file mode 100644
index 00000000..d5ae8473
--- /dev/null
+++ b/modules/audio_coding/OWNERS
@@ -0,0 +1 @@
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/audio_coding/main/acm2/acm_cng.h b/modules/audio_coding/main/acm2/acm_cng.h
index a0c1c554..8b0a3928 100644
--- a/modules/audio_coding/main/acm2/acm_cng.h
+++ b/modules/audio_coding/main/acm2/acm_cng.h
@@ -35,7 +35,8 @@ class ACMCNG: public ACMGenericCodec {
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
protected:
- void DestructEncoderSafe();
+ void DestructEncoderSafe() OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalCreateEncoder();
diff --git a/modules/audio_coding/main/acm2/acm_g722.h b/modules/audio_coding/main/acm2/acm_g722.h
index 6197a9d9..6cdd79d4 100644
--- a/modules/audio_coding/main/acm2/acm_g722.h
+++ b/modules/audio_coding/main/acm2/acm_g722.h
@@ -33,7 +33,9 @@ class ACMG722 : public ACMGenericCodec {
// For FEC.
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
+ int16_t InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
@@ -44,7 +46,8 @@ class ACMG722 : public ACMGenericCodec {
const uint8_t audio_channel)
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
- void DestructEncoderSafe();
+ void DestructEncoderSafe() OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalCreateEncoder();
diff --git a/modules/audio_coding/main/acm2/acm_generic_codec.cc b/modules/audio_coding/main/acm2/acm_generic_codec.cc
index a4808c0e..d16d1d38 100644
--- a/modules/audio_coding/main/acm2/acm_generic_codec.cc
+++ b/modules/audio_coding/main/acm2/acm_generic_codec.cc
@@ -60,7 +60,6 @@ ACMGenericCodec::ACMGenericCodec()
sent_cn_previous_(false),
prev_frame_cng_(0),
has_internal_fec_(false),
- neteq_decode_lock_(NULL),
codec_wrapper_lock_(*RWLockWrapper::CreateRWLock()),
last_timestamp_(0xD87F3F9F),
unique_id_(0) {
@@ -210,7 +209,6 @@ int16_t ACMGenericCodec::Encode(uint8_t* bitstream,
return 0;
}
WriteLockScoped lockCodec(codec_wrapper_lock_);
- ReadLockScoped lockNetEq(*neteq_decode_lock_);
// Not all codecs accept the whole frame to be pushed into encoder at once.
// Some codecs needs to be feed with a specific number of samples different
@@ -394,7 +392,6 @@ int16_t ACMGenericCodec::EncoderParamsSafe(WebRtcACMCodecParams* enc_params) {
int16_t ACMGenericCodec::ResetEncoder() {
WriteLockScoped lockCodec(codec_wrapper_lock_);
- ReadLockScoped lockNetEq(*neteq_decode_lock_);
return ResetEncoderSafe();
}
@@ -443,7 +440,6 @@ int16_t ACMGenericCodec::InternalResetEncoder() {
int16_t ACMGenericCodec::InitEncoder(WebRtcACMCodecParams* codec_params,
bool force_initialization) {
WriteLockScoped lockCodec(codec_wrapper_lock_);
- ReadLockScoped lockNetEq(*neteq_decode_lock_);
return InitEncoderSafe(codec_params, force_initialization);
}
@@ -629,7 +625,6 @@ int16_t ACMGenericCodec::CreateEncoder() {
void ACMGenericCodec::DestructEncoderInst(void* ptr_inst) {
if (ptr_inst != NULL) {
WriteLockScoped lockCodec(codec_wrapper_lock_);
- ReadLockScoped lockNetEq(*neteq_decode_lock_);
InternalDestructEncoderInst(ptr_inst);
}
}
diff --git a/modules/audio_coding/main/acm2/acm_generic_codec.h b/modules/audio_coding/main/acm2/acm_generic_codec.h
index fa21ca01..80f239ac 100644
--- a/modules/audio_coding/main/acm2/acm_generic_codec.h
+++ b/modules/audio_coding/main/acm2/acm_generic_codec.h
@@ -294,17 +294,6 @@ class ACMGenericCodec {
int32_t IsInternalDTXReplaced(bool* internal_dtx_replaced);
///////////////////////////////////////////////////////////////////////////
- // void SetNetEqDecodeLock()
- // Passes the NetEq lock to the codec.
- //
- // Input:
- // -neteq_decode_lock : pointer to the lock associated with NetEQ of ACM.
- //
- void SetNetEqDecodeLock(RWLockWrapper* neteq_decode_lock) {
- neteq_decode_lock_ = neteq_decode_lock;
- }
-
- ///////////////////////////////////////////////////////////////////////////
// bool HasInternalDTX()
// Used to check if the codec has internal DTX.
//
@@ -312,7 +301,10 @@ class ACMGenericCodec {
// true if the codec has an internal DTX, e.g. G729,
// false otherwise.
//
- bool HasInternalDTX() const { return has_internal_dtx_; }
+ bool HasInternalDTX() const {
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return has_internal_dtx_;
+ }
///////////////////////////////////////////////////////////////////////////
// int32_t GetEstimatedBandwidth()
@@ -436,7 +428,8 @@ class ACMGenericCodec {
// -1 if failed, or if this is meaningless for the given codec.
// 0 if succeeded.
//
- virtual int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz);
+ virtual int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz)
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// EncoderSampFreq()
@@ -450,7 +443,8 @@ class ACMGenericCodec {
// -1 if failed to output sampling rate.
// 0 if the sample rate is returned successfully.
//
- virtual int16_t EncoderSampFreq(uint16_t* samp_freq_hz);
+ virtual int16_t EncoderSampFreq(uint16_t* samp_freq_hz)
+ SHARED_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// int32_t ConfigISACBandwidthEstimator()
@@ -515,8 +509,6 @@ class ACMGenericCodec {
//
virtual int32_t SetISACMaxRate(const uint32_t max_rate_bps);
- int32_t FrameSize() { return frame_len_smpl_; }
-
///////////////////////////////////////////////////////////////////////////
// REDPayloadISAC()
// This is an iSAC-specific function. The function is called to get RED
@@ -569,7 +561,10 @@ class ACMGenericCodec {
// true if the codec has an internal FEC, e.g. Opus.
// false otherwise.
//
- bool HasInternalFEC() const { return has_internal_fec_; }
+ bool HasInternalFEC() const {
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return has_internal_fec_;
+ }
///////////////////////////////////////////////////////////////////////////
// int SetFEC();
@@ -624,7 +619,8 @@ class ACMGenericCodec {
// See EncoderParam() for the description of function, input(s)/output(s)
// and return value.
//
- int16_t EncoderParamsSafe(WebRtcACMCodecParams* enc_params);
+ int16_t EncoderParamsSafe(WebRtcACMCodecParams* enc_params)
+ SHARED_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// See ResetEncoder() for the description of function, input(s)/output(s)
@@ -651,7 +647,8 @@ class ACMGenericCodec {
// See DestructEncoder() for the description of function,
// input(s)/output(s) and return value.
//
- virtual void DestructEncoderSafe() = 0;
+ virtual void DestructEncoderSafe()
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_) = 0;
///////////////////////////////////////////////////////////////////////////
// See SetBitRate() for the description of function, input(s)/output(s)
@@ -659,7 +656,8 @@ class ACMGenericCodec {
//
// Any codec that can change the bit-rate has to implement this.
//
- virtual int16_t SetBitRateSafe(const int32_t bitrate_bps);
+ virtual int16_t SetBitRateSafe(const int32_t bitrate_bps)
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// See GetEstimatedBandwidth() for the description of function,
@@ -707,7 +705,7 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
- int16_t CreateEncoder();
+ int16_t CreateEncoder() EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// int16_t EnableVAD();
@@ -773,7 +771,8 @@ class ACMGenericCodec {
// otherwise the length of the bit-stream is returned.
//
virtual int16_t InternalEncode(uint8_t* bitstream,
- int16_t* bitstream_len_byte) = 0;
+ int16_t* bitstream_len_byte)
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_) = 0;
///////////////////////////////////////////////////////////////////////////
// int16_t InternalInitEncoder()
@@ -794,7 +793,8 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
- virtual int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params) = 0;
+ virtual int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params)
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_) = 0;
///////////////////////////////////////////////////////////////////////////
// void IncreaseNoMissedSamples()
@@ -805,7 +805,8 @@ class ACMGenericCodec {
// -num_samples : the number of overwritten samples is incremented
// by this value.
//
- void IncreaseNoMissedSamples(const int16_t num_samples);
+ void IncreaseNoMissedSamples(const int16_t num_samples)
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// int16_t InternalCreateEncoder()
@@ -849,7 +850,8 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
- virtual int16_t InternalResetEncoder();
+ virtual int16_t InternalResetEncoder()
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
///////////////////////////////////////////////////////////////////////////
// int16_t ProcessFrameVADDTX()
@@ -900,41 +902,42 @@ class ACMGenericCodec {
// &in_audio_[in_audio_ix_write_] always point to where new audio can be
// written to
- int16_t in_audio_ix_write_;
+ int16_t in_audio_ix_write_ GUARDED_BY(codec_wrapper_lock_);
// &in_audio_[in_audio_ix_read_] points to where audio has to be read from
- int16_t in_audio_ix_read_;
+ int16_t in_audio_ix_read_ GUARDED_BY(codec_wrapper_lock_);
- int16_t in_timestamp_ix_write_;
+ int16_t in_timestamp_ix_write_ GUARDED_BY(codec_wrapper_lock_);
// Where the audio is stored before encoding,
// To save memory the following buffer can be allocated
// dynamically for 80 ms depending on the sampling frequency
// of the codec.
- int16_t* in_audio_;
- uint32_t* in_timestamp_;
+ int16_t* in_audio_ GUARDED_BY(codec_wrapper_lock_);
+ uint32_t* in_timestamp_ GUARDED_BY(codec_wrapper_lock_);
- int16_t frame_len_smpl_;
- uint16_t num_channels_;
+ int16_t frame_len_smpl_ GUARDED_BY(codec_wrapper_lock_);
+ uint16_t num_channels_ GUARDED_BY(codec_wrapper_lock_);
// This will point to a static database of the supported codecs
- int16_t codec_id_;
+ int16_t codec_id_ GUARDED_BY(codec_wrapper_lock_);
// This will account for the number of samples were not encoded
// the case is rare, either samples are missed due to overwrite
// at input buffer or due to encoding error
- uint32_t num_missed_samples_;
+ uint32_t num_missed_samples_ GUARDED_BY(codec_wrapper_lock_);
// True if the encoder instance created
- bool encoder_exist_;
+ bool encoder_exist_ GUARDED_BY(codec_wrapper_lock_);
// True if the encoder instance initialized
- bool encoder_initialized_;
+ bool encoder_initialized_ GUARDED_BY(codec_wrapper_lock_);
- const bool registered_in_neteq_; // TODO(henrik.lundin) Remove?
+ const bool registered_in_neteq_
+ GUARDED_BY(codec_wrapper_lock_); // TODO(henrik.lundin) Remove?
// VAD/DTX
- bool has_internal_dtx_;
+ bool has_internal_dtx_ GUARDED_BY(codec_wrapper_lock_);
WebRtcVadInst* ptr_vad_inst_ GUARDED_BY(codec_wrapper_lock_);
bool vad_enabled_ GUARDED_BY(codec_wrapper_lock_);
ACMVADMode vad_mode_ GUARDED_BY(codec_wrapper_lock_);
@@ -947,13 +950,9 @@ class ACMGenericCodec {
int16_t prev_frame_cng_ GUARDED_BY(codec_wrapper_lock_);
// FEC.
- bool has_internal_fec_;
-
- WebRtcACMCodecParams encoder_params_;
+ bool has_internal_fec_ GUARDED_BY(codec_wrapper_lock_);
- // Used as a global lock for all available decoders
- // so that no decoder is used when NetEQ decodes.
- RWLockWrapper* neteq_decode_lock_;
+ WebRtcACMCodecParams encoder_params_ GUARDED_BY(codec_wrapper_lock_);
// Used to lock wrapper internal data
// such as buffers and state variables.
diff --git a/modules/audio_coding/main/acm2/acm_ilbc.h b/modules/audio_coding/main/acm2/acm_ilbc.h
index fd6e8537..714c9004 100644
--- a/modules/audio_coding/main/acm2/acm_ilbc.h
+++ b/modules/audio_coding/main/acm2/acm_ilbc.h
@@ -29,14 +29,18 @@ class ACMILBC : public ACMGenericCodec {
// for FEC
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
+ int16_t InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
protected:
- int16_t SetBitRateSafe(const int32_t rate);
+ int16_t SetBitRateSafe(const int32_t rate) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
- void DestructEncoderSafe();
+ void DestructEncoderSafe() OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalCreateEncoder();
diff --git a/modules/audio_coding/main/acm2/acm_isac.cc b/modules/audio_coding/main/acm2/acm_isac.cc
index 9fbcdd4c..2adae861 100644
--- a/modules/audio_coding/main/acm2/acm_isac.cc
+++ b/modules/audio_coding/main/acm2/acm_isac.cc
@@ -694,7 +694,10 @@ int32_t ACMISAC::ConfigISACBandwidthEstimator(
"Couldn't config iSAC BWE.");
return -1;
}
- UpdateFrameLen();
+ {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ UpdateFrameLen();
+ }
CriticalSectionScoped lock(codec_inst_crit_sect_.get());
ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &isac_current_bn_);
return 0;
@@ -792,6 +795,7 @@ int ACMISAC::ErrorCode() {
AudioDecoder* ACMISAC::Decoder(int codec_id) {
// Create iSAC instance if it does not exist.
+ WriteLockScoped wl(codec_wrapper_lock_);
if (!encoder_exist_) {
CriticalSectionScoped lock(codec_inst_crit_sect_.get());
assert(codec_inst_ptr_->inst == NULL);
diff --git a/modules/audio_coding/main/acm2/acm_isac.h b/modules/audio_coding/main/acm2/acm_isac.h
index 3249526f..31263c70 100644
--- a/modules/audio_coding/main/acm2/acm_isac.h
+++ b/modules/audio_coding/main/acm2/acm_isac.h
@@ -34,19 +34,23 @@ class ACMISAC : public ACMGenericCodec, AudioDecoder {
explicit ACMISAC(int16_t codec_id);
~ACMISAC();
- int16_t InternalInitDecoder(WebRtcACMCodecParams* codec_params);
+ int16_t InternalInitDecoder(WebRtcACMCodecParams* codec_params)
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
// Methods below are inherited from ACMGenericCodec.
ACMGenericCodec* CreateInstance(void) OVERRIDE;
int16_t InternalEncode(uint8_t* bitstream,
- int16_t* bitstream_len_byte) OVERRIDE;
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
- int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params) OVERRIDE;
+ int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t UpdateDecoderSampFreq(int16_t codec_id) OVERRIDE;
- int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz) OVERRIDE;
+ int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t EncoderSampFreq(uint16_t* samp_freq_hz) OVERRIDE;
@@ -95,12 +99,14 @@ class ACMISAC : public ACMGenericCodec, AudioDecoder {
int32_t rate,
bool is_red);
- void UpdateFrameLen();
+ void UpdateFrameLen() EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
// Methods below are inherited from ACMGenericCodec.
- void DestructEncoderSafe() OVERRIDE;
+ void DestructEncoderSafe() OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
- int16_t SetBitRateSafe(const int32_t bit_rate) OVERRIDE;
+ int16_t SetBitRateSafe(const int32_t bit_rate) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int32_t GetEstimatedBandwidthSafe() OVERRIDE;
diff --git a/modules/audio_coding/main/acm2/acm_opus.h b/modules/audio_coding/main/acm2/acm_opus.h
index 07ce0721..b94adc47 100644
--- a/modules/audio_coding/main/acm2/acm_opus.h
+++ b/modules/audio_coding/main/acm2/acm_opus.h
@@ -28,7 +28,9 @@ class ACMOpus : public ACMGenericCodec {
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
+ int16_t InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
@@ -43,7 +45,8 @@ class ACMOpus : public ACMGenericCodec {
void InternalDestructEncoderInst(void* ptr_inst);
- int16_t SetBitRateSafe(const int32_t rate);
+ int16_t SetBitRateSafe(const int32_t rate) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
WebRtcOpusEncInst* encoder_inst_ptr_;
uint16_t sample_freq_;
diff --git a/modules/audio_coding/main/acm2/acm_pcm16b.h b/modules/audio_coding/main/acm2/acm_pcm16b.h
index 23b8c121..de4330d5 100644
--- a/modules/audio_coding/main/acm2/acm_pcm16b.h
+++ b/modules/audio_coding/main/acm2/acm_pcm16b.h
@@ -25,12 +25,15 @@ class ACMPCM16B : public ACMGenericCodec {
// For FEC.
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
+ int16_t InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
protected:
- void DestructEncoderSafe();
+ void DestructEncoderSafe() OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalCreateEncoder();
diff --git a/modules/audio_coding/main/acm2/acm_pcma.h b/modules/audio_coding/main/acm2/acm_pcma.h
index 2da873cb..a2d8874a 100644
--- a/modules/audio_coding/main/acm2/acm_pcma.h
+++ b/modules/audio_coding/main/acm2/acm_pcma.h
@@ -25,7 +25,9 @@ class ACMPCMA : public ACMGenericCodec {
// For FEC.
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
+ int16_t InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
diff --git a/modules/audio_coding/main/acm2/acm_pcmu.h b/modules/audio_coding/main/acm2/acm_pcmu.h
index 18d8279d..7aa83b75 100644
--- a/modules/audio_coding/main/acm2/acm_pcmu.h
+++ b/modules/audio_coding/main/acm2/acm_pcmu.h
@@ -25,12 +25,15 @@ class ACMPCMU : public ACMGenericCodec {
// For FEC.
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
+ int16_t InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
protected:
- void DestructEncoderSafe();
+ void DestructEncoderSafe() OVERRIDE
+ EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
int16_t InternalCreateEncoder();
diff --git a/modules/audio_coding/main/acm2/acm_receiver.cc b/modules/audio_coding/main/acm2/acm_receiver.cc
index cb7c4184..f40250f2 100644
--- a/modules/audio_coding/main/acm2/acm_receiver.cc
+++ b/modules/audio_coding/main/acm2/acm_receiver.cc
@@ -26,7 +26,6 @@
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logging.h"
-#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/system_wrappers/interface/trace.h"
@@ -126,7 +125,6 @@ AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config)
nack_(),
nack_enabled_(false),
neteq_(NetEq::Create(config.neteq_config)),
- decode_lock_(RWLockWrapper::CreateRWLock()),
vad_enabled_(true),
clock_(config.clock),
av_sync_(false),
@@ -149,7 +147,6 @@ AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config)
AcmReceiver::~AcmReceiver() {
delete neteq_;
- delete decode_lock_;
}
int AcmReceiver::SetMinimumDelay(int delay_ms) {
@@ -331,22 +328,18 @@ int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
}
} // |crit_sect_| is released.
- {
- WriteLockScoped lock_codecs(*decode_lock_); // Lock to prevent an encoding.
-
- // If |missing_packets_sync_stream_| is allocated then we are in AV-sync and
- // we may need to insert sync-packets. We don't check |av_sync_| as we are
- // outside AcmReceiver's critical section.
- if (missing_packets_sync_stream_.get()) {
- InsertStreamOfSyncPackets(missing_packets_sync_stream_.get());
- }
+ // If |missing_packets_sync_stream_| is allocated then we are in AV-sync and
+ // we may need to insert sync-packets. We don't check |av_sync_| as we are
+ // outside AcmReceiver's critical section.
+ if (missing_packets_sync_stream_.get()) {
+ InsertStreamOfSyncPackets(missing_packets_sync_stream_.get());
+ }
- if (neteq_->InsertPacket(rtp_header, incoming_payload, length_payload,
- receive_timestamp) < 0) {
- LOG_FERR1(LS_ERROR, "AcmReceiver::InsertPacket", header->payloadType) <<
- " Failed to insert packet";
- return -1;
- }
+ if (neteq_->InsertPacket(rtp_header, incoming_payload, length_payload,
+ receive_timestamp) < 0) {
+ LOG_FERR1(LS_ERROR, "AcmReceiver::InsertPacket", header->payloadType) <<
+ " Failed to insert packet";
+ return -1;
}
return 0;
}
@@ -384,24 +377,20 @@ int AcmReceiver::GetAudio(int desired_freq_hz, AudioFrame* audio_frame) {
}
}
- {
- WriteLockScoped lock_codecs(*decode_lock_); // Lock to prevent an encoding.
-
- // If |late_packets_sync_stream_| is allocated then we have been in AV-sync
- // mode and we might have to insert sync-packets.
- if (late_packets_sync_stream_.get()) {
- InsertStreamOfSyncPackets(late_packets_sync_stream_.get());
- if (return_silence) // Silence generated, don't pull from NetEq.
- return 0;
- }
+ // If |late_packets_sync_stream_| is allocated then we have been in AV-sync
+ // mode and we might have to insert sync-packets.
+ if (late_packets_sync_stream_.get()) {
+ InsertStreamOfSyncPackets(late_packets_sync_stream_.get());
+ if (return_silence) // Silence generated, don't pull from NetEq.
+ return 0;
+ }
- if (neteq_->GetAudio(AudioFrame::kMaxDataSizeSamples,
- ptr_audio_buffer,
- &samples_per_channel,
- &num_channels, &type) != NetEq::kOK) {
- LOG_FERR0(LS_ERROR, "AcmReceiver::GetAudio") << "NetEq Failed.";
- return -1;
- }
+ if (neteq_->GetAudio(AudioFrame::kMaxDataSizeSamples,
+ ptr_audio_buffer,
+ &samples_per_channel,
+ &num_channels, &type) != NetEq::kOK) {
+ LOG_FERR0(LS_ERROR, "AcmReceiver::GetAudio") << "NetEq Failed.";
+ return -1;
}
// Accessing members, take the lock.
diff --git a/modules/audio_coding/main/acm2/acm_receiver.h b/modules/audio_coding/main/acm2/acm_receiver.h
index b6898f73..dd6de528 100644
--- a/modules/audio_coding/main/acm2/acm_receiver.h
+++ b/modules/audio_coding/main/acm2/acm_receiver.h
@@ -30,7 +30,6 @@ namespace webrtc {
struct CodecInst;
class CriticalSectionWrapper;
-class RWLockWrapper;
class NetEq;
namespace acm2 {
@@ -210,13 +209,6 @@ class AcmReceiver {
bool vad_enabled() const { return vad_enabled_; }
//
- // Get the decode lock used to protect decoder instances while decoding.
- //
- // Return value : Pointer to the decode lock.
- //
- RWLockWrapper* DecodeLock() const { return decode_lock_; }
-
- //
// Flushes the NetEq packet and speech buffers.
//
void FlushBuffers();
@@ -354,7 +346,6 @@ class AcmReceiver {
CallStatistics call_stats_ GUARDED_BY(crit_sect_);
NetEq* neteq_;
Decoder decoders_[ACMCodecDB::kMaxNumCodecs];
- RWLockWrapper* decode_lock_;
bool vad_enabled_;
Clock* clock_; // TODO(henrik.lundin) Make const if possible.
diff --git a/modules/audio_coding/main/acm2/audio_coding_module_impl.cc b/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
index a07e8543..f2410b7d 100644
--- a/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
+++ b/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
@@ -749,7 +749,6 @@ ACMGenericCodec* AudioCodingModuleImpl::CreateCodec(const CodecInst& codec) {
return my_codec;
}
my_codec->SetUniqueID(id_);
- my_codec->SetNetEqDecodeLock(receiver_.DecodeLock());
return my_codec;
}
@@ -1203,6 +1202,7 @@ int AudioCodingModuleImpl::SendBitrate() const {
// Set available bandwidth, inform the encoder about the estimated bandwidth
// received from the remote party.
int AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(int bw) {
+ CriticalSectionScoped lock(acm_crit_sect_);
return codecs_[current_send_codec_idx_]->SetEstimatedBandwidth(bw);
}
@@ -1452,6 +1452,7 @@ int AudioCodingModuleImpl::SetREDStatus(
//
bool AudioCodingModuleImpl::CodecFEC() const {
+ CriticalSectionScoped lock(acm_crit_sect_);
return codec_fec_enabled_;
}
@@ -1476,6 +1477,7 @@ int AudioCodingModuleImpl::SetCodecFEC(bool enable_codec_fec) {
}
int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) {
+ CriticalSectionScoped lock(acm_crit_sect_);
if (HaveValidEncoder("SetPacketLossRate") &&
codecs_[current_send_codec_idx_]->SetPacketLossRate(loss_rate) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
@@ -1950,6 +1952,7 @@ int AudioCodingModuleImpl::REDPayloadISAC(int isac_rate,
int isac_bw_estimate,
uint8_t* payload,
int16_t* length_bytes) {
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("EncodeData")) {
return -1;
}
diff --git a/modules/audio_coding/main/acm2/audio_coding_module_impl.h b/modules/audio_coding/main/acm2/audio_coding_module_impl.h
index e54202bf..02290da0 100644
--- a/modules/audio_coding/main/acm2/audio_coding_module_impl.h
+++ b/modules/audio_coding/main/acm2/audio_coding_module_impl.h
@@ -214,6 +214,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// GET RED payload for iSAC. The method id called when 'this' ACM is
// the default ACM.
+ // TODO(henrik.lundin) Not used. Remove?
int REDPayloadISAC(int isac_rate,
int isac_bw_estimate,
uint8_t* payload,
@@ -248,7 +249,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
int InitializeReceiverSafe() EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
- bool HaveValidEncoder(const char* caller_name) const;
+ bool HaveValidEncoder(const char* caller_name) const
+ EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
// Set VAD/DTX status. This function does not acquire a lock, and it is
// created to be called only from inside a critical section.
@@ -303,7 +305,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// codec owns the decoder-instance. For such codecs |*decoder| should be a
// valid pointer, otherwise it will be NULL.
int GetAudioDecoder(const CodecInst& codec, int codec_id,
- int mirror_id, AudioDecoder** decoder);
+ int mirror_id, AudioDecoder** decoder)
+ EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
CriticalSectionWrapper* acm_crit_sect_;
int id_; // TODO(henrik.lundin) Make const.
@@ -320,13 +323,14 @@ class AudioCodingModuleImpl : public AudioCodingModule {
bool vad_enabled_ GUARDED_BY(acm_crit_sect_);
bool dtx_enabled_ GUARDED_BY(acm_crit_sect_);
ACMVADMode vad_mode_ GUARDED_BY(acm_crit_sect_);
- ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs];
- int mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs];
+ ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs]
+ GUARDED_BY(acm_crit_sect_);
+ int mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs] GUARDED_BY(acm_crit_sect_);
bool stereo_send_ GUARDED_BY(acm_crit_sect_);
- int current_send_codec_idx_;
- bool send_codec_registered_;
+ int current_send_codec_idx_ GUARDED_BY(acm_crit_sect_);
+ bool send_codec_registered_ GUARDED_BY(acm_crit_sect_);
ACMResampler resampler_ GUARDED_BY(acm_crit_sect_);
- AcmReceiver receiver_;
+ AcmReceiver receiver_; // AcmReceiver has it's own internal lock.
// RED.
bool is_first_red_ GUARDED_BY(acm_crit_sect_);
@@ -345,7 +349,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
uint32_t last_red_timestamp_ GUARDED_BY(acm_crit_sect_);
// Codec internal FEC
- bool codec_fec_enabled_;
+ bool codec_fec_enabled_ GUARDED_BY(acm_crit_sect_);
// This is to keep track of CN instances where we can send DTMFs.
uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_);
diff --git a/modules/audio_coding/main/interface/audio_coding_module.h b/modules/audio_coding/main/interface/audio_coding_module.h
index cb0953aa..48270047 100644
--- a/modules/audio_coding/main/interface/audio_coding_module.h
+++ b/modules/audio_coding/main/interface/audio_coding_module.h
@@ -330,6 +330,7 @@ class AudioCodingModule: public Module {
// -1 if error occurred in setting the bandwidth,
// 0 bandwidth is set successfully.
//
+ // TODO(henrik.lundin) Unused. Remove?
virtual int32_t SetReceivedEstimatedBandwidth(
const int32_t bw) = 0;
diff --git a/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index 3c5f6b0b..3e3540a8 100644
--- a/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -575,7 +575,6 @@ size_t ReplacePayload(webrtc::test::InputAudioFile* replacement_audio_file,
" not supported or unknown." << std::endl;
webrtc::Trace::ReturnTrace();
exit(1);
- assert(false);
}
}
return payload_len;
diff --git a/modules/audio_conference_mixer/BUILD.gn b/modules/audio_conference_mixer/BUILD.gn
new file mode 100644
index 00000000..a27bb84c
--- /dev/null
+++ b/modules/audio_conference_mixer/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+config("internal_config") {
+ visibility = ":*" # Only targets in this file can depend on this.
+ include_dirs = [
+ "interface",
+ "../interface",
+ ]
+}
+
+source_set("audio_conference_mixer") {
+ sources = [
+ "interface/audio_conference_mixer.h",
+ "interface/audio_conference_mixer_defines.h",
+ "source/audio_conference_mixer_impl.cc",
+ "source/audio_conference_mixer_impl.h",
+ "source/audio_frame_manipulator.cc",
+ "source/audio_frame_manipulator.h",
+ "source/level_indicator.cc",
+ "source/level_indicator.h",
+ "source/memory_pool.h",
+ "source/memory_pool_posix.h",
+ "source/memory_pool_win.h",
+ "source/time_scheduler.cc",
+ "source/time_scheduler.h",
+ ]
+
+ direct_dependent_configs = [ ":internal_config" ]
+
+ deps = [
+ "../../system_wrappers",
+ "../audio_processing",
+ "../utility",
+ ]
+}
diff --git a/modules/audio_conference_mixer/OWNERS b/modules/audio_conference_mixer/OWNERS
index 7dc791ef..7d4cc610 100644
--- a/modules/audio_conference_mixer/OWNERS
+++ b/modules/audio_conference_mixer/OWNERS
@@ -1,3 +1,5 @@
henrike@webrtc.org
pwestin@webrtc.org
-andrew@webrtc.org \ No newline at end of file
+andrew@webrtc.org
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
new file mode 100644
index 00000000..d6481ad5
--- /dev/null
+++ b/modules/audio_device/BUILD.gn
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("audio_device") {
+ # TODO(henrike): Implement.
+}
diff --git a/modules/audio_device/OWNERS b/modules/audio_device/OWNERS
index 7bb3cd52..1fe45940 100644
--- a/modules/audio_device/OWNERS
+++ b/modules/audio_device/OWNERS
@@ -9,3 +9,5 @@ per-file *.isolate=kjellander@webrtc.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
new file mode 100644
index 00000000..a727d54b
--- /dev/null
+++ b/modules/audio_processing/BUILD.gn
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("audio_processing") {
+ # TODO(andrew): Implement.
+}
diff --git a/modules/audio_processing/OWNERS b/modules/audio_processing/OWNERS
index 7c1f7881..41a82af2 100644
--- a/modules/audio_processing/OWNERS
+++ b/modules/audio_processing/OWNERS
@@ -6,3 +6,5 @@ bjornv@webrtc.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/audio_processing/aec/aec_core_neon.c b/modules/audio_processing/aec/aec_core_neon.c
index cec0a7e3..5cce4897 100644
--- a/modules/audio_processing/aec/aec_core_neon.c
+++ b/modules/audio_processing/aec/aec_core_neon.c
@@ -30,6 +30,104 @@ __inline static float MulRe(float aRe, float aIm, float bRe, float bIm) {
return aRe * bRe - aIm * bIm;
}
+static float32x4_t vdivq_f32(float32x4_t a, float32x4_t b) {
+ int i;
+ float32x4_t x = vrecpeq_f32(b);
+ // from arm documentation
+ // The Newton-Raphson iteration:
+ // x[n+1] = x[n] * (2 - d * x[n])
+ // converges to (1/d) if x0 is the result of VRECPE applied to d.
+ //
+ // Note: The precision did not improve after 2 iterations.
+ for (i = 0; i < 2; i++) {
+ x = vmulq_f32(vrecpsq_f32(b, x), x);
+ }
+ // a/b = a*(1/b)
+ return vmulq_f32(a, x);
+}
+
+static float32x4_t vsqrtq_f32(float32x4_t s) {
+ int i;
+ float32x4_t x = vrsqrteq_f32(s);
+
+ // Code to handle sqrt(0).
+ // If the input to sqrtf() is zero, a zero will be returned.
+ // If the input to vrsqrteq_f32() is zero, positive infinity is returned.
+ const uint32x4_t vec_p_inf = vdupq_n_u32(0x7F800000);
+ // check for divide by zero
+ const uint32x4_t div_by_zero = vceqq_u32(vec_p_inf, vreinterpretq_u32_f32(x));
+ // zero out the positive infinity results
+ x = vreinterpretq_f32_u32(vandq_u32(vmvnq_u32(div_by_zero),
+ vreinterpretq_u32_f32(x)));
+ // from arm documentation
+ // The Newton-Raphson iteration:
+ // x[n+1] = x[n] * (3 - d * (x[n] * x[n])) / 2)
+ // converges to (1/√d) if x0 is the result of VRSQRTE applied to d.
+ //
+ // Note: The precision did not improve after 2 iterations.
+ for (i = 0; i < 2; i++) {
+ x = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x, x), s), x);
+ }
+ // sqrt(s) = s * 1/sqrt(s)
+ return vmulq_f32(s, x);;
+}
+
+static void ScaleErrorSignalNEON(AecCore* aec, float ef[2][PART_LEN1]) {
+ const float mu = aec->extended_filter_enabled ? kExtendedMu : aec->normal_mu;
+ const float error_threshold = aec->extended_filter_enabled ?
+ kExtendedErrorThreshold : aec->normal_error_threshold;
+ const float32x4_t k1e_10f = vdupq_n_f32(1e-10f);
+ const float32x4_t kMu = vmovq_n_f32(mu);
+ const float32x4_t kThresh = vmovq_n_f32(error_threshold);
+ int i;
+ // vectorized code (four at once)
+ for (i = 0; i + 3 < PART_LEN1; i += 4) {
+ const float32x4_t xPow = vld1q_f32(&aec->xPow[i]);
+ const float32x4_t ef_re_base = vld1q_f32(&ef[0][i]);
+ const float32x4_t ef_im_base = vld1q_f32(&ef[1][i]);
+ const float32x4_t xPowPlus = vaddq_f32(xPow, k1e_10f);
+ float32x4_t ef_re = vdivq_f32(ef_re_base, xPowPlus);
+ float32x4_t ef_im = vdivq_f32(ef_im_base, xPowPlus);
+ const float32x4_t ef_re2 = vmulq_f32(ef_re, ef_re);
+ const float32x4_t ef_sum2 = vmlaq_f32(ef_re2, ef_im, ef_im);
+ const float32x4_t absEf = vsqrtq_f32(ef_sum2);
+ const uint32x4_t bigger = vcgtq_f32(absEf, kThresh);
+ const float32x4_t absEfPlus = vaddq_f32(absEf, k1e_10f);
+ const float32x4_t absEfInv = vdivq_f32(kThresh, absEfPlus);
+ uint32x4_t ef_re_if = vreinterpretq_u32_f32(vmulq_f32(ef_re, absEfInv));
+ uint32x4_t ef_im_if = vreinterpretq_u32_f32(vmulq_f32(ef_im, absEfInv));
+ uint32x4_t ef_re_u32 = vandq_u32(vmvnq_u32(bigger),
+ vreinterpretq_u32_f32(ef_re));
+ uint32x4_t ef_im_u32 = vandq_u32(vmvnq_u32(bigger),
+ vreinterpretq_u32_f32(ef_im));
+ ef_re_if = vandq_u32(bigger, ef_re_if);
+ ef_im_if = vandq_u32(bigger, ef_im_if);
+ ef_re_u32 = vorrq_u32(ef_re_u32, ef_re_if);
+ ef_im_u32 = vorrq_u32(ef_im_u32, ef_im_if);
+ ef_re = vmulq_f32(vreinterpretq_f32_u32(ef_re_u32), kMu);
+ ef_im = vmulq_f32(vreinterpretq_f32_u32(ef_im_u32), kMu);
+ vst1q_f32(&ef[0][i], ef_re);
+ vst1q_f32(&ef[1][i], ef_im);
+ }
+ // scalar code for the remaining items.
+ for (; i < PART_LEN1; i++) {
+ float abs_ef;
+ ef[0][i] /= (aec->xPow[i] + 1e-10f);
+ ef[1][i] /= (aec->xPow[i] + 1e-10f);
+ abs_ef = sqrtf(ef[0][i] * ef[0][i] + ef[1][i] * ef[1][i]);
+
+ if (abs_ef > error_threshold) {
+ abs_ef = error_threshold / (abs_ef + 1e-10f);
+ ef[0][i] *= abs_ef;
+ ef[1][i] *= abs_ef;
+ }
+
+ // Stepsize factor
+ ef[0][i] *= mu;
+ ef[1][i] *= mu;
+ }
+}
+
static void FilterAdaptationNEON(AecCore* aec,
float* fft,
float ef[2][PART_LEN1]) {
@@ -298,6 +396,7 @@ static void OverdriveAndSuppressNEON(AecCore* aec,
}
void WebRtcAec_InitAec_neon(void) {
+ WebRtcAec_ScaleErrorSignal = ScaleErrorSignalNEON;
WebRtcAec_FilterAdaptation = FilterAdaptationNEON;
WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressNEON;
}
diff --git a/modules/audio_processing/aec/aec_core_sse2.c b/modules/audio_processing/aec/aec_core_sse2.c
index 8d4afdba..1489d26e 100644
--- a/modules/audio_processing/aec/aec_core_sse2.c
+++ b/modules/audio_processing/aec/aec_core_sse2.c
@@ -354,8 +354,8 @@ static __m128 mm_pow_ps(__m128 a, __m128 b) {
return a_exp_b;
}
-extern const float WebRtcAec_weightCurve[65];
-extern const float WebRtcAec_overDriveCurve[65];
+extern ALIGN16_BEG const float ALIGN16_END WebRtcAec_weightCurve[65];
+extern ALIGN16_BEG const float ALIGN16_END WebRtcAec_overDriveCurve[65];
static void OverdriveAndSuppressSSE2(AecCore* aec,
float hNl[PART_LEN1],
diff --git a/modules/audio_processing/aec/system_delay_unittest.cc b/modules/audio_processing/aec/system_delay_unittest.cc
index a13d4762..5fbc5600 100644
--- a/modules/audio_processing/aec/system_delay_unittest.cc
+++ b/modules/audio_processing/aec/system_delay_unittest.cc
@@ -248,7 +248,8 @@ TEST_F(SystemDelayTest, CorrectDelayAfterUnstableStartup) {
}
}
-TEST_F(SystemDelayTest, CorrectDelayAfterStableBufferBuildUp) {
+TEST_F(SystemDelayTest,
+ DISABLED_ON_ANDROID(CorrectDelayAfterStableBufferBuildUp)) {
// In this test we start by establishing the device buffer size during stable
// conditions, but with an empty internal far-end buffer. Once that is done we
// verify that the system delay is increased correctly until we have reach an
@@ -332,7 +333,7 @@ TEST_F(SystemDelayTest, CorrectDelayWhenBufferUnderrun) {
}
}
-TEST_F(SystemDelayTest, CorrectDelayDuringDrift) {
+TEST_F(SystemDelayTest, DISABLED_ON_ANDROID(CorrectDelayDuringDrift)) {
// This drift test should verify that the system delay is never exceeding the
// device buffer. The drift is simulated by decreasing the reported device
// buffer size by 1 ms every 100 ms. If the device buffer size goes below 30
@@ -366,7 +367,7 @@ TEST_F(SystemDelayTest, CorrectDelayDuringDrift) {
}
}
-TEST_F(SystemDelayTest, ShouldRecoverAfterGlitch) {
+TEST_F(SystemDelayTest, DISABLED_ON_ANDROID(ShouldRecoverAfterGlitch)) {
// This glitch test should verify that the system delay recovers if there is
// a glitch in data. The data glitch is constructed as 200 ms of buffering
// after which the stable procedure continues. The glitch is never reported by
diff --git a/modules/bitrate_controller/BUILD.gn b/modules/bitrate_controller/BUILD.gn
new file mode 100644
index 00000000..c3ac28ce
--- /dev/null
+++ b/modules/bitrate_controller/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("bitrate_controller") {
+ sources = [
+ "bitrate_controller_impl.cc",
+ "bitrate_controller_impl.h",
+ "include/bitrate_controller.h",
+ "send_side_bandwidth_estimation.cc",
+ "send_side_bandwidth_estimation.h",
+ ]
+
+ if (is_win) {
+ cflags = [
+ # TODO(jschuh): Bug 1348: fix this warning.
+ "/wd4267" # size_t to int truncations
+ ]
+ }
+
+ deps = [ "../../system_wrappers" ]
+}
diff --git a/modules/bitrate_controller/OWNERS b/modules/bitrate_controller/OWNERS
index cce3a26b..9420ba2e 100644
--- a/modules/bitrate_controller/OWNERS
+++ b/modules/bitrate_controller/OWNERS
@@ -8,3 +8,5 @@ asapersson@webrtc.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
new file mode 100644
index 00000000..0ccb18a1
--- /dev/null
+++ b/modules/desktop_capture/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("desktop_capture") {
+ # TODO(jiayl): Implement.
+}
+
+if (!is_ios && (cpu_arch == "x86" || cpu_arch == "x64")) {
+ source_set("desktop_capture_differ_sse2") {
+ # TODO(jiayl): Implement.
+ }
+}
diff --git a/modules/desktop_capture/OWNERS b/modules/desktop_capture/OWNERS
index e85861b8..4c0340d6 100644
--- a/modules/desktop_capture/OWNERS
+++ b/modules/desktop_capture/OWNERS
@@ -6,3 +6,5 @@ wez@chromium.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/desktop_capture/win/screen_capturer_win_gdi.cc b/modules/desktop_capture/win/screen_capturer_win_gdi.cc
index 9cb3681f..dc10eceb 100644
--- a/modules/desktop_capture/win/screen_capturer_win_gdi.cc
+++ b/modules/desktop_capture/win/screen_capturer_win_gdi.cc
@@ -133,7 +133,8 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
callback_->OnCaptureCompleted(frame);
// Check for cursor shape update.
- CaptureCursor();
+ if (mouse_shape_observer_)
+ CaptureCursor();
}
void ScreenCapturerWinGdi::SetMouseShapeObserver(
@@ -279,6 +280,8 @@ bool ScreenCapturerWinGdi::CaptureImage() {
}
void ScreenCapturerWinGdi::CaptureCursor() {
+ assert(mouse_shape_observer_);
+
CURSORINFO cursor_info;
cursor_info.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&cursor_info)) {
@@ -317,8 +320,7 @@ void ScreenCapturerWinGdi::CaptureCursor() {
// Record the last cursor image that we sent to the client.
last_cursor_ = *cursor;
- if (mouse_shape_observer_)
- mouse_shape_observer_->OnCursorShapeChanged(cursor.release());
+ mouse_shape_observer_->OnCursorShapeChanged(cursor.release());
}
} // namespace webrtc
diff --git a/modules/media_file/BUILD.gn b/modules/media_file/BUILD.gn
new file mode 100644
index 00000000..971a6fa2
--- /dev/null
+++ b/modules/media_file/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+config("internal_config") {
+ visibility = ":*" # Only targets in this file can depend on this.
+ include_dirs = [
+ "interface",
+ "../interface",
+ ]
+}
+
+source_set("media_file") {
+ sources = [
+ "interface/media_file.h",
+ "interface/media_file_defines.h",
+ "source/avi_file.cc",
+ "source/avi_file.h",
+ "source/media_file_impl.cc",
+ "source/media_file_impl.h",
+ "source/media_file_utility.cc",
+ "source/media_file_utility.h",
+ ]
+
+ if (is_win) {
+ cflags = [
+ # TODO(jschuh): Bug 1348: fix this warning.
+ "/wd4267", # size_t to int truncations
+ ]
+ }
+
+ direct_dependent_configs = [ ":internal_config" ]
+
+ deps = [ "../../system_wrappers" ]
+}
diff --git a/modules/media_file/OWNERS b/modules/media_file/OWNERS
index 2cc47e48..3387ee9e 100644
--- a/modules/media_file/OWNERS
+++ b/modules/media_file/OWNERS
@@ -1,4 +1,6 @@
pwestin@webrtc.org
mflodman@webrtc.org
perkj@webrtc.org
-niklas.enbom@webrtc.org \ No newline at end of file
+niklas.enbom@webrtc.org
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/pacing/BUILD.gn b/modules/pacing/BUILD.gn
new file mode 100644
index 00000000..d3eceb35
--- /dev/null
+++ b/modules/pacing/BUILD.gn
@@ -0,0 +1,16 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+source_set("pacing") {
+ sources = [
+ "include/paced_sender.h",
+ "paced_sender.cc",
+ ]
+
+ deps = [ "../../system_wrappers" ]
+}
diff --git a/modules/pacing/OWNERS b/modules/pacing/OWNERS
index 1426abc6..4486a81e 100644
--- a/modules/pacing/OWNERS
+++ b/modules/pacing/OWNERS
@@ -7,3 +7,5 @@ asapersson@webrtc.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/remote_bitrate_estimator/BUILD.gn b/modules/remote_bitrate_estimator/BUILD.gn
new file mode 100644
index 00000000..7ee4c8df
--- /dev/null
+++ b/modules/remote_bitrate_estimator/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+source_set("remote_bitrate_estimator") {
+ sources = [
+ "overuse_detector.cc",
+ "overuse_detector.h",
+ "remote_bitrate_estimator_single_stream.cc",
+ "remote_rate_control.cc",
+ "remote_rate_control.h",
+ ]
+}
diff --git a/modules/remote_bitrate_estimator/OWNERS b/modules/remote_bitrate_estimator/OWNERS
index eab2b8e0..49d19429 100644
--- a/modules/remote_bitrate_estimator/OWNERS
+++ b/modules/remote_bitrate_estimator/OWNERS
@@ -3,7 +3,10 @@ stefan@webrtc.org
henrik.lundin@webrtc.org
mflodman@webrtc.org
asapersson@webrtc.org
+
# These are for the common case of adding or renaming files. If you're doing
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
new file mode 100644
index 00000000..e9a2e8d9
--- /dev/null
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -0,0 +1,104 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("rtp_rtcp") {
+ sources = [
+ # Common
+ "interface/fec_receiver.h",
+ "interface/receive_statistics.h",
+ "interface/remote_ntp_time_estimator.h",
+ "interface/rtp_header_parser.h",
+ "interface/rtp_payload_registry.h",
+ "interface/rtp_receiver.h",
+ "interface/rtp_rtcp.h",
+ "interface/rtp_rtcp_defines.h",
+ "source/bitrate.cc",
+ "source/bitrate.h",
+ "source/byte_io.h",
+ "source/fec_receiver_impl.cc",
+ "source/fec_receiver_impl.h",
+ "source/receive_statistics_impl.cc",
+ "source/receive_statistics_impl.h",
+ "source/remote_ntp_time_estimator.cc",
+ "source/rtp_header_parser.cc",
+ "source/rtp_rtcp_config.h",
+ "source/rtp_rtcp_impl.cc",
+ "source/rtp_rtcp_impl.h",
+ "source/rtcp_packet.cc",
+ "source/rtcp_packet.h",
+ "source/rtcp_receiver.cc",
+ "source/rtcp_receiver.h",
+ "source/rtcp_receiver_help.cc",
+ "source/rtcp_receiver_help.h",
+ "source/rtcp_sender.cc",
+ "source/rtcp_sender.h",
+ "source/rtcp_utility.cc",
+ "source/rtcp_utility.h",
+ "source/rtp_header_extension.cc",
+ "source/rtp_header_extension.h",
+ "source/rtp_receiver_impl.cc",
+ "source/rtp_receiver_impl.h",
+ "source/rtp_sender.cc",
+ "source/rtp_sender.h",
+ "source/rtp_utility.cc",
+ "source/rtp_utility.h",
+ "source/ssrc_database.cc",
+ "source/ssrc_database.h",
+ "source/tmmbr_help.cc",
+ "source/tmmbr_help.h",
+ # Audio Files
+ "source/dtmf_queue.cc",
+ "source/dtmf_queue.h",
+ "source/rtp_receiver_audio.cc",
+ "source/rtp_receiver_audio.h",
+ "source/rtp_sender_audio.cc",
+ "source/rtp_sender_audio.h",
+ # Video Files
+ "source/fec_private_tables_random.h",
+ "source/fec_private_tables_bursty.h",
+ "source/forward_error_correction.cc",
+ "source/forward_error_correction.h",
+ "source/forward_error_correction_internal.cc",
+ "source/forward_error_correction_internal.h",
+ "source/producer_fec.cc",
+ "source/producer_fec.h",
+ "source/rtp_packet_history.cc",
+ "source/rtp_packet_history.h",
+ "source/rtp_payload_registry.cc",
+ "source/rtp_receiver_strategy.cc",
+ "source/rtp_receiver_strategy.h",
+ "source/rtp_receiver_video.cc",
+ "source/rtp_receiver_video.h",
+ "source/rtp_sender_video.cc",
+ "source/rtp_sender_video.h",
+ "source/video_codec_information.h",
+ "source/rtp_format_vp8.cc",
+ "source/rtp_format_vp8.h",
+ "source/rtp_format_video_generic.h",
+ "source/vp8_partition_aggregator.cc",
+ "source/vp8_partition_aggregator.h",
+ # Mocks
+ "mocks/mock_rtp_rtcp.h",
+ "source/mock/mock_rtp_payload_strategy.h",
+ ]
+
+ deps = [
+ "../../system_wrappers",
+ "../pacing",
+ "../remote_bitrate_estimator",
+ ]
+
+ if (is_win) {
+ cflags = [
+ # TODO(jschuh): Bug 1348: fix this warning.
+ "/wd4267", # size_t to int truncations
+ ]
+ }
+}
diff --git a/modules/rtp_rtcp/OWNERS b/modules/rtp_rtcp/OWNERS
index c9685642..cafe4c19 100644
--- a/modules/rtp_rtcp/OWNERS
+++ b/modules/rtp_rtcp/OWNERS
@@ -2,4 +2,6 @@ pwestin@webrtc.org
stefan@webrtc.org
henrik.lundin@webrtc.org
mflodman@webrtc.org
-asapersson@webrtc.org \ No newline at end of file
+asapersson@webrtc.org
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/utility/BUILD.gn b/modules/utility/BUILD.gn
new file mode 100644
index 00000000..82512046
--- /dev/null
+++ b/modules/utility/BUILD.gn
@@ -0,0 +1,48 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("utility") {
+ sources = [
+ "interface/audio_frame_operations.h",
+ "interface/file_player.h",
+ "interface/file_recorder.h",
+ "interface/helpers_android.h",
+ "interface/process_thread.h",
+ "interface/rtp_dump.h",
+ "source/audio_frame_operations.cc",
+ "source/coder.cc",
+ "source/coder.h",
+ "source/file_player_impl.cc",
+ "source/file_player_impl.h",
+ "source/file_recorder_impl.cc",
+ "source/file_recorder_impl.h",
+ "source/helpers_android.cc",
+ "source/process_thread_impl.cc",
+ "source/process_thread_impl.h",
+ "source/rtp_dump_impl.cc",
+ "source/rtp_dump_impl.h",
+ ]
+
+ deps = [
+ "../../common_audio",
+ "../../system_wrappers",
+ "../audio_coding",
+ "../media_file",
+ ]
+ if (enable_video) {
+ sources += [
+ "source/frame_scaler.cc",
+ "source/video_coder.cc",
+ "source/video_frames_queue.cc",
+ ]
+
+ deps += [ "../video_coding" ]
+ }
+}
diff --git a/modules/utility/OWNERS b/modules/utility/OWNERS
index 674c7380..dbdb53e3 100644
--- a/modules/utility/OWNERS
+++ b/modules/utility/OWNERS
@@ -1,4 +1,6 @@
henrike@webrtc.org
pwestin@webrtc.org
asapersson@webrtc.org
-perkj@webrtc.org \ No newline at end of file
+perkj@webrtc.org
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
new file mode 100644
index 00000000..fd3fe574
--- /dev/null
+++ b/modules/video_capture/BUILD.gn
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("video_capture") {
+ # TODO(glaznev): Implement.
+}
diff --git a/modules/video_capture/OWNERS b/modules/video_capture/OWNERS
index fdc2a3ff..ba897650 100644
--- a/modules/video_capture/OWNERS
+++ b/modules/video_capture/OWNERS
@@ -11,3 +11,5 @@ per-file *.isolate=kjellander@webrtc.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
index c8abdbe3..2f571d0c 100644
--- a/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
+++ b/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
@@ -11,20 +11,18 @@
package org.webrtc.videoengine;
import java.io.IOException;
-import java.util.Locale;
import java.util.concurrent.Exchanger;
-import java.util.concurrent.locks.ReentrantLock;
import android.content.Context;
import android.graphics.ImageFormat;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
import android.graphics.SurfaceTexture;
-import android.graphics.YuvImage;
import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera;
+import android.opengl.GLES11Ext;
+import android.opengl.GLES20;
import android.os.Handler;
import android.os.Looper;
+import android.os.SystemClock;
import android.util.Log;
import android.view.OrientationEventListener;
import android.view.SurfaceHolder.Callback;
@@ -50,11 +48,15 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
private final Camera.CameraInfo info;
private final OrientationEventListener orientationListener;
private final long native_capturer; // |VideoCaptureAndroid*| in C++.
- private SurfaceTexture dummySurfaceTexture;
+ private SurfaceTexture cameraSurfaceTexture;
+ private int[] cameraGlTextures = null;
// Arbitrary queue depth. Higher number means more memory allocated & held,
// lower number means more sensitivity to processing time in the client (and
// potentially stalling the capturer if it runs out of buffers to write to).
private final int numCaptureBuffers = 3;
+ private double averageDurationMs;
+ private long lastCaptureTimeMs;
+ private int frameCount;
// Requests future capturers to send their frames to |localPreview| directly.
public static void setLocalPreview(SurfaceHolder localPreview) {
@@ -114,6 +116,8 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
private synchronized boolean startCapture(
final int width, final int height,
final int min_mfps, final int max_mfps) {
+ Log.d(TAG, "startCapture: " + width + "x" + height + "@" +
+ min_mfps + ":" + max_mfps);
if (cameraThread != null || cameraThreadHandler != null) {
throw new RuntimeException("Camera thread already started!");
}
@@ -121,7 +125,6 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
cameraThread = new CameraThread(handlerExchanger);
cameraThread.start();
cameraThreadHandler = exchange(handlerExchanger, null);
- orientationListener.enable();
final Exchanger<Boolean> result = new Exchanger<Boolean>();
cameraThreadHandler.post(new Runnable() {
@@ -129,14 +132,14 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
startCaptureOnCameraThread(width, height, min_mfps, max_mfps, result);
}
});
- return exchange(result, false); // |false| is a dummy value here.
+ boolean startResult = exchange(result, false); // |false| is a dummy value.
+ orientationListener.enable();
+ return startResult;
}
private void startCaptureOnCameraThread(
int width, int height, int min_mfps, int max_mfps,
Exchanger<Boolean> result) {
- Log.d(TAG, "startCapture: " + width + "x" + height + "@" +
- min_mfps + ":" + max_mfps);
Throwable error = null;
try {
camera = Camera.open(id);
@@ -150,13 +153,27 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
} else {
// No local renderer (we only care about onPreviewFrame() buffers, not a
// directly-displayed UI element). Camera won't capture without
- // setPreview{Texture,Display}, so we create a dummy SurfaceTexture and
- // hand it over to Camera, but never listen for frame-ready callbacks,
+ // setPreview{Texture,Display}, so we create a SurfaceTexture and hand
+ // it over to Camera, but never listen for frame-ready callbacks,
// and never call updateTexImage on it.
try {
- // "42" because http://goo.gl/KaEn8
- dummySurfaceTexture = new SurfaceTexture(42);
- camera.setPreviewTexture(dummySurfaceTexture);
+ cameraGlTextures = new int[1];
+ // Generate one texture pointer and bind it as an external texture.
+ GLES20.glGenTextures(1, cameraGlTextures, 0);
+ GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
+ cameraGlTextures[0]);
+ GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
+ GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
+ GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
+ GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
+ GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
+ GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+
+ cameraSurfaceTexture = new SurfaceTexture(cameraGlTextures[0]);
+ cameraSurfaceTexture.setOnFrameAvailableListener(null);
+ camera.setPreviewTexture(cameraSurfaceTexture);
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -178,6 +195,8 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
camera.addCallbackBuffer(new byte[bufSize]);
}
camera.setPreviewCallbackWithBuffer(this);
+ frameCount = 0;
+ averageDurationMs = 1000 / max_mfps;
camera.startPreview();
exchange(result, true);
return;
@@ -198,6 +217,8 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
// Called by native code. Returns true when camera is known to be stopped.
private synchronized boolean stopCapture() {
+ Log.d(TAG, "stopCapture");
+ orientationListener.disable();
final Exchanger<Boolean> result = new Exchanger<Boolean>();
cameraThreadHandler.post(new Runnable() {
@Override public void run() {
@@ -212,14 +233,12 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
}
cameraThreadHandler = null;
cameraThread = null;
- orientationListener.disable();
+ Log.d(TAG, "stopCapture done");
return status;
}
private void stopCaptureOnCameraThread(
Exchanger<Boolean> result) {
- Log.d(TAG, "stopCapture");
- Looper.myLooper().quit();
if (camera == null) {
throw new RuntimeException("Camera is already stopped!");
}
@@ -232,10 +251,16 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
camera.setPreviewDisplay(null);
} else {
camera.setPreviewTexture(null);
+ cameraSurfaceTexture = null;
+ if (cameraGlTextures != null) {
+ GLES20.glDeleteTextures(1, cameraGlTextures, 0);
+ cameraGlTextures = null;
+ }
}
camera.release();
camera = null;
exchange(result, true);
+ Looper.myLooper().quit();
return;
} catch (IOException e) {
error = e;
@@ -244,11 +269,12 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
}
Log.e(TAG, "Failed to stop camera", error);
exchange(result, false);
+ Looper.myLooper().quit();
return;
}
private native void ProvideCameraFrame(
- byte[] data, int length, long captureObject);
+ byte[] data, int length, long timeStamp, long captureObject);
// Called on cameraThread so must not "synchronized".
@Override
@@ -262,7 +288,19 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
if (camera != callbackCamera) {
throw new RuntimeException("Unexpected camera in callback!");
}
- ProvideCameraFrame(data, data.length, native_capturer);
+ frameCount++;
+ long captureTimeMs = SystemClock.elapsedRealtime();
+ if (frameCount > 1) {
+ double durationMs = captureTimeMs - lastCaptureTimeMs;
+ averageDurationMs = 0.9 * averageDurationMs + 0.1 * durationMs;
+ if ((frameCount % 30) == 0) {
+ Log.d(TAG, "Camera TS " + captureTimeMs +
+ ". Duration: " + (int)durationMs + " ms. FPS: " +
+ (int) (1000 / averageDurationMs + 0.5));
+ }
+ }
+ lastCaptureTimeMs = captureTimeMs;
+ ProvideCameraFrame(data, data.length, captureTimeMs, native_capturer);
camera.addCallbackBuffer(data);
}
diff --git a/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java b/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
index 1d681c06..fe207ca3 100644
--- a/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
+++ b/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
@@ -10,14 +10,8 @@
package org.webrtc.videoengine;
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
-import android.content.Context;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.Size;
@@ -99,6 +93,7 @@ public class VideoCaptureDeviceInfoAndroid {
.put("mfpsRanges", mfpsRanges);
}
String ret = devices.toString(2);
+ Log.d(TAG, ret);
return ret;
} catch (JSONException e) {
throw new RuntimeException(e);
diff --git a/modules/video_capture/android/video_capture_android.cc b/modules/video_capture/android/video_capture_android.cc
index c9aa52ce..6f0200e6 100644
--- a/modules/video_capture/android/video_capture_android.cc
+++ b/modules/video_capture/android/video_capture_android.cc
@@ -15,6 +15,7 @@
#include "webrtc/modules/video_capture/android/device_info_android.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logcat_trace_context.h"
+#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/ref_count.h"
#include "webrtc/system_wrappers/interface/trace.h"
@@ -36,6 +37,7 @@ void JNICALL ProvideCameraFrame(
jobject,
jbyteArray javaCameraFrame,
jint length,
+ jlong timeStamp,
jlong context) {
webrtc::videocapturemodule::VideoCaptureAndroid* captureModule =
reinterpret_cast<webrtc::videocapturemodule::VideoCaptureAndroid*>(
@@ -90,7 +92,7 @@ int32_t SetCaptureAndroidVM(JavaVM* javaVM, jobject context) {
"(JI)V",
reinterpret_cast<void*>(&OnOrientationChanged)},
{"ProvideCameraFrame",
- "([BIJ)V",
+ "([BIJJ)V",
reinterpret_cast<void*>(&ProvideCameraFrame)}};
if (ats.env()->RegisterNatives(g_java_capturer_class,
native_methods, 3) != 0)
@@ -146,18 +148,18 @@ int32_t VideoCaptureAndroid::Init(const int32_t id,
return -1;
// Store the device name
+ LOG(LS_INFO) << "VideoCaptureAndroid::Init: " << deviceUniqueIdUTF8;
+ size_t camera_id = 0;
+ if (!_deviceInfo.FindCameraIndex(deviceUniqueIdUTF8, &camera_id))
+ return -1;
_deviceUniqueId = new char[nameLength + 1];
memcpy(_deviceUniqueId, deviceUniqueIdUTF8, nameLength + 1);
AttachThreadScoped ats(g_jvm);
JNIEnv* env = ats.env();
-
jmethodID ctor = env->GetMethodID(g_java_capturer_class, "<init>", "(IJ)V");
assert(ctor);
jlong j_this = reinterpret_cast<intptr_t>(this);
- size_t camera_id = 0;
- if (!_deviceInfo.FindCameraIndex(deviceUniqueIdUTF8, &camera_id))
- return -1;
_jCapturer = env->NewGlobalRef(
env->NewObject(g_java_capturer_class, ctor, camera_id, j_this));
assert(_jCapturer);
@@ -234,7 +236,6 @@ int32_t VideoCaptureAndroid::CaptureSettings(
int32_t VideoCaptureAndroid::SetCaptureRotation(
VideoCaptureRotation rotation) {
- CriticalSectionScoped cs(&_apiCs);
int32_t status = VideoCaptureImpl::SetCaptureRotation(rotation);
if (status != 0)
return status;
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
new file mode 100644
index 00000000..f5a69b18
--- /dev/null
+++ b/modules/video_coding/BUILD.gn
@@ -0,0 +1,86 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("video_coding") {
+ sources = [
+ "main/interface/video_coding.h",
+ "main/interface/video_coding_defines.h",
+ "main/source/codec_database.cc",
+ "main/source/codec_database.h",
+ "main/source/codec_timer.cc",
+ "main/source/codec_timer.h",
+ "main/source/content_metrics_processing.cc",
+ "main/source/content_metrics_processing.h",
+ "main/source/decoding_state.cc",
+ "main/source/decoding_state.h",
+ "main/source/encoded_frame.cc",
+ "main/source/encoded_frame.h",
+ "main/source/er_tables_xor.h",
+ "main/source/fec_tables_xor.h",
+ "main/source/frame_buffer.cc",
+ "main/source/frame_buffer.h",
+ "main/source/generic_decoder.cc",
+ "main/source/generic_decoder.h",
+ "main/source/generic_encoder.cc",
+ "main/source/generic_encoder.h",
+ "main/source/inter_frame_delay.cc",
+ "main/source/inter_frame_delay.h",
+ "main/source/internal_defines.h",
+ "main/source/jitter_buffer.cc",
+ "main/source/jitter_buffer.h",
+ "main/source/jitter_buffer_common.h",
+ "main/source/jitter_estimator.cc",
+ "main/source/jitter_estimator.h",
+ "main/source/media_opt_util.cc",
+ "main/source/media_opt_util.h",
+ "main/source/media_optimization.cc",
+ "main/source/media_optimization.h",
+ "main/source/nack_fec_tables.h",
+ "main/source/packet.cc",
+ "main/source/packet.h",
+ "main/source/qm_select_data.h",
+ "main/source/qm_select.cc",
+ "main/source/qm_select.h",
+ "main/source/receiver.cc",
+ "main/source/receiver.h",
+ "main/source/rtt_filter.cc",
+ "main/source/rtt_filter.h",
+ "main/source/session_info.cc",
+ "main/source/session_info.h",
+ "main/source/timestamp_map.cc",
+ "main/source/timestamp_map.h",
+ "main/source/timing.cc",
+ "main/source/timing.h",
+ "main/source/video_coding_impl.cc",
+ "main/source/video_coding_impl.h",
+ "main/source/video_receiver.cc",
+ "main/source/video_sender.cc",
+ ]
+
+ deps = [
+ ":video_coding_utility",
+ ":webrtc_i420",
+ ":webrtc_vp8",
+ "../../common_video",
+ "../../system_wrappers",
+ ]
+}
+
+source_set("video_coding_utility") {
+ # TODO(stefan): Implement.
+}
+
+source_set("webrtc_i420") {
+ # TODO(stefan): Implement.
+}
+
+source_set("webrtc_vp8") {
+ # TODO(stefan): Implement.
+}
diff --git a/modules/video_coding/OWNERS b/modules/video_coding/OWNERS
index 7183cf21..037de93f 100644
--- a/modules/video_coding/OWNERS
+++ b/modules/video_coding/OWNERS
@@ -2,3 +2,5 @@ stefan@webrtc.org
mikhal@webrtc.org
marpan@webrtc.org
henrik.lundin@webrtc.org
+
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/video_processing/BUILD.gn b/modules/video_processing/BUILD.gn
new file mode 100644
index 00000000..40171caf
--- /dev/null
+++ b/modules/video_processing/BUILD.gn
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("video_processing") {
+ # TODO(stefan): Implement.
+}
diff --git a/modules/video_processing/OWNERS b/modules/video_processing/OWNERS
new file mode 100644
index 00000000..d5ae8473
--- /dev/null
+++ b/modules/video_processing/OWNERS
@@ -0,0 +1 @@
+per-file BUILD.gn=kjellander@webrtc.org
diff --git a/modules/video_render/BUILD.gn b/modules/video_render/BUILD.gn
new file mode 100644
index 00000000..c569b7fa
--- /dev/null
+++ b/modules/video_render/BUILD.gn
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("video_render") {
+ # TODO(wuchengli): Implement.
+}
diff --git a/modules/video_render/OWNERS b/modules/video_render/OWNERS
index 7dd4a362..da941f40 100644
--- a/modules/video_render/OWNERS
+++ b/modules/video_render/OWNERS
@@ -10,3 +10,5 @@ per-file *.isolate=kjellander@webrtc.org
# structural changes, please get a review from a reviewer in this file.
per-file *.gyp=*
per-file *.gypi=*
+
+per-file BUILD.gn=kjellander@webrtc.org