GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — STT: Use 1kb for web sockets frames · semtle/java-sdk@9c57fec

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/websocket
    • SpeechToTextWebSocketListener.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/websocket/SpeechToTextWebSocketListener.java‎

Copy file name to clipboardExpand all lines: speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/websocket/SpeechToTextWebSocketListener.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public final class SpeechToTextWebSocketListener extends WebSocketListener {
4949
private static final String START = "start";
5050
private static final String STOP = "stop";
5151
private static final String ACTION = "action";
52-
private static final int FOUR_KB = 4096;
52+
private static final int ONE_KB = 1024;
5353
private static final String ERROR = "error";
5454
private static final String RESULTS = "results";
5555
private static final String SPEAKER_LABELS = "speaker_labels";
@@ -182,14 +182,14 @@ public void run() {
182182
* @param inputStream the input stream
183183
*/
184184
private void sendInputStream(InputStream inputStream) {
185-
byte[] buffer = new byte[FOUR_KB];
185+
byte[] buffer = new byte[ONE_KB];
186186
int read;
187187
try {
188188
// This method uses a blocking while loop to receive all contents of the underlying input stream.
189189
// AudioInputStreams, typically used for streaming microphone inputs return 0 only when the stream has been
190190
// closed. Elsewise AudioInputStream.read() blocks until enough audio frames are read.
191191
while (((read = inputStream.read(buffer)) > 0) && socketOpen) {
192-
if (read == FOUR_KB) {
192+
if (read == ONE_KB) {
193193
socket.send(ByteString.of(buffer));
194194
} else {
195195
socket.send(ByteString.of(Arrays.copyOfRange(buffer, 0, read)));

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.