Fix a problem in Thread::Send.
Previously if thread A->Send is called on thread B, B->ReceiveSends will be called, which enables an arbitrary thread to invoke calls on B while B is wait for A->Send to return. This caused mutliple problems like issue 3559, 3579.
The fix is to limit B->ReceiveSends to only process requests from A.
Also disallow the worker thread invoking other threads.

BUG=3559
R=juberti@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn@7290 4adac7df-926f-26a2-2b94-8c16560cd09d
Add missing DesktopConfigurationMonitor Unlock in webrtc::ScreenCapturerMac

BUG=3837
R=jiayl@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn@7291 4adac7df-926f-26a2-2b94-8c16560cd09d
Enable render downmixing to mono in AudioProcessing.

In practice, we have been doing this since time immemorial, but have
relied on the user to do the downmixing (first voice engine then
Chromium). It's more logical for this burden to fall on AudioProcessing,
however, who can be expected to know that this is a reasonable approach
for AEC. Permitting two render channels results in running two AECs
serially.

Critically, in my recent change to have Chromium adopt the float
interface:
https://codereview.chromium.org/420603004
I removed the downmixing by Chromium, forgetting that we hadn't yet
enabled this feature in AudioProcessing. This corrects that oversight.

The change in paths hit by production users is very minor. As commented
it required adding downmixing to the int16_t path to satisfy
bit-exactness tests.

For reference, find the ApmTest.Process errors here:
https://paste.googleplex.com/6372007910309888

BUG=webrtc:3853
TESTED=listened to the files output from the Process test, and verified
that they sound as expected: higher echo while the AEC is adapting, but
afterwards very close.

R=aluebs@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn@7292 4adac7df-926f-26a2-2b94-8c16560cd09d
Call SSL_shutdown in OpenSSLStreamAdapter::Cleanup.

BUG=crbug/414211
R=juberti@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn@7293 4adac7df-926f-26a2-2b94-8c16560cd09d
Revert "Call SSL_shutdown in OpenSSLStreamAdapter::Cleanup." (rev 7293).

Breaks windows bot as it was already showing on the try jobs on the

BUG=crbug/414211
R=jiayl@webrtc.org,juberti@webrtc.org
TBR=jiayl@webrtc.org,juberti@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn@7294 4adac7df-926f-26a2-2b94-8c16560cd09d
Fix typo from RtpPacketizerH264.

BUG=
R=pbos@webrtc.org

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

Patch from Changbin Shao <changbin.shao@intel.com>.

git-svn-id: http://webrtc.googlecode.com/svn@7295 4adac7df-926f-26a2-2b94-8c16560cd09d
Revert r7049/r7123, which added unnecessary "u"s to "return 0"s.

r7049 added some unnecessary casts ("return 0" -> "return static_cast<uint16_t>(0)").  r7123 converted these to "return 0u".  The original impetus for this was to eliminate type conversion warnings.  However, the 'u's are unnecessary; Visual Studio can return "0" from a function returning an unsigned value without producing a warning.  The real reason for the original warnings was that the code was returning -1 from a function returning an unsigned value, which does need a cast; the -1s were eliminated before the above two revisions landed.

Also reverse the order of some conditionals to prevent possible underflow.
While the underflow wouldn't have changed the behavior of the code, it's easier
to reason about the code when such underflow can't happen, and possibly safer
against future modifications as well.

BUG=3663
TEST=none
R=tina.legrand@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn@7296 4adac7df-926f-26a2-2b94-8c16560cd09d