diff options
author | Chia-chi Yeh <chiachi@android.com> | 2010-07-20 18:19:23 +0800 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2010-07-20 18:19:23 +0800 |
commit | 6045bdee92ccc237828c3dc208cb4d476665c574 (patch) | |
tree | dacbe479415452b001a8f0dcae3582fa564c10ef | |
parent | 2be81a52ec4037c9eba312631069d80aebdbcbdf (diff) | |
download | nist-sip-6045bdee92ccc237828c3dc208cb4d476665c574.tar.gz |
RTP: drain DeviceSocket before starting DeviceThread.
Change-Id: I9c0a8fb3c115449926472ae575a6aea3910525c4
-rw-r--r-- | src/jni/rtp_jni/AudioGroup.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/jni/rtp_jni/AudioGroup.cpp b/src/jni/rtp_jni/AudioGroup.cpp index 8c76235..390cb4b 100644 --- a/src/jni/rtp_jni/AudioGroup.cpp +++ b/src/jni/rtp_jni/AudioGroup.cpp @@ -479,6 +479,9 @@ private: bool start() { + char c; + while (recv(mGroup->mDeviceSocket, &c, 1, MSG_DONTWAIT) == 1); + if (run("Device", ANDROID_PRIORITY_AUDIO) != NO_ERROR) { LOGE("cannot start device thread"); return false; @@ -663,7 +666,8 @@ bool AudioGroup::set(int sampleRate, int sampleCount) tv.tv_sec = 0; tv.tv_usec = 1000 * sampleCount / sampleRate * 500; if (setsockopt(pair[0], SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) || - setsockopt(pair[0], SOL_SOCKET, SO_RCVBUF, &output, sizeof(output))) { + setsockopt(pair[0], SOL_SOCKET, SO_RCVBUF, &output, sizeof(output)) || + setsockopt(pair[1], SOL_SOCKET, SO_SNDBUF, &output, sizeof(output))) { LOGE("setsockopt: %s", strerror(errno)); return false; } |