Skip to content

Commit

Permalink
further improve latency
Browse files Browse the repository at this point in the history
  • Loading branch information
teamclouday committed May 9, 2022
1 parent c5c25de commit 3e9210d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
android:theme="@style/Theme.Microphone"
android:name=".DefaultApp">
<activity
android:name=".MainActivity"
android:exported="true">
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.coroutines.sync.withLock
class AudioBuffer
{
// set buffer size for latency
private val BUFFER_SIZE = 5
private val BUFFER_SIZE = 2
// actual buffer of byte arrays (FIFO with queue)
private val buffer = ArrayDeque<ByteArray>()
// mutex for coroutines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class ForegroundService : Service() {
while(!states.streamShouldStop.get() && !states.isIPInfoSet.get())
delay(WAIT_PERIOD)
}
sharedBuffer.reset()
showMessage("Starting streaming")
if(managerStream?.start() == true && managerStream?.isConnected() == true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BluetoothStreamer(private val ctx : Context) : Streamer {
try {
val streamOut = socket!!.outputStream
streamOut.write(data)
streamOut.flush()
// streamOut.flush()
} catch (e : IOException)
{
Log.d(TAG, "stream: ${e.message}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class WifiStreamer(private val ctx : Context) : Streamer {
try {
val streamOut = socket!!.outputStream
streamOut.write(data)
streamOut.flush()
// streamOut.flush()
} catch (e : IOException)
{
Log.d(TAG, "${e.message}")
Expand Down
2 changes: 1 addition & 1 deletion Windows/AndroidMic/Library/Audio/AudioBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace AndroidMic.Audio
{
public class AudioBuffer
{
public const int MAX_BUFFER_SIZE = 5;
public const int MAX_BUFFER_SIZE = 2;
private readonly Queue<byte[]> buffer = new Queue<byte[]>();
private readonly object toLock = new object();

Expand Down

0 comments on commit 3e9210d

Please sign in to comment.