radames commited on
Commit
be97094
1 Parent(s): 3207814
frontend/src/lib/components/VideoInput.svelte CHANGED
@@ -12,7 +12,7 @@
12
  let videoFrameCallbackId: number;
13
  const WIDTH = 512;
14
  const HEIGHT = 512;
15
- const THROTTLE_FPS = 10;
16
 
17
  onDestroy(() => {
18
  if (videoFrameCallbackId) videoEl.cancelVideoFrameCallback(videoFrameCallbackId);
 
12
  let videoFrameCallbackId: number;
13
  const WIDTH = 512;
14
  const HEIGHT = 512;
15
+ const THROTTLE_FPS = 6;
16
 
17
  onDestroy(() => {
18
  if (videoFrameCallbackId) videoEl.cancelVideoFrameCallback(videoFrameCallbackId);
frontend/src/lib/lcmLive.ts CHANGED
@@ -41,6 +41,7 @@ export const lcmLiveActions = {
41
  const userId = data.userId;
42
  lcmLiveStatus.set(LCMLiveStatus.CONNECTED);
43
  streamId.set(userId);
 
44
  break;
45
  case "timeout":
46
  console.log("timeout");
 
41
  const userId = data.userId;
42
  lcmLiveStatus.set(LCMLiveStatus.CONNECTED);
43
  streamId.set(userId);
44
+ resolve(userId);
45
  break;
46
  case "timeout":
47
  console.log("timeout");
frontend/src/lib/store.ts CHANGED
@@ -1,4 +1,7 @@
1
 
2
- import { writable, type Writable } from 'svelte/store';
 
 
3
 
4
  export const pipelineValues = writable({} as Record<string, any>);
 
 
1
 
2
+ import {
3
+ writable, type Writable, get
4
+ } from 'svelte/store';
5
 
6
  export const pipelineValues = writable({} as Record<string, any>);
7
+ export const getPipelineValues = () => get(pipelineValues);
frontend/src/routes/+page.svelte CHANGED
@@ -15,7 +15,7 @@
15
  onFrameChangeStore,
16
  MediaStreamStatusEnum
17
  } from '$lib/mediaStream';
18
- import { pipelineValues } from '$lib/store';
19
 
20
  let pipelineParams: FieldProps[];
21
  let pipelineInfo: PipelineInfo;
@@ -33,17 +33,8 @@
33
  isImageMode = pipelineInfo.input_mode.default === PipelineMode.IMAGE;
34
  maxQueueSize = settings.max_queue_size;
35
  pipelineParams = pipelineParams.filter((e) => e?.disabled !== true);
36
- console.log('PARAMS', pipelineParams);
37
- console.log('SETTINGS', pipelineInfo);
38
  }
39
- console.log('isImageMode', isImageMode);
40
 
41
- $: {
42
- console.log('lcmLiveState', $lcmLiveStatus);
43
- }
44
- $: {
45
- console.log('mediaStreamState', $mediaStreamStatus);
46
- }
47
  // send Webcam stream to LCM if image mode
48
  $: {
49
  if (
@@ -51,7 +42,7 @@
51
  $lcmLiveStatus === LCMLiveStatus.CONNECTED &&
52
  $mediaStreamStatus === MediaStreamStatusEnum.CONNECTED
53
  ) {
54
- lcmLiveActions.send($pipelineValues);
55
  lcmLiveActions.send($onFrameChangeStore.blob);
56
  }
57
  }
@@ -67,13 +58,16 @@
67
  // lcmLiveActions.send($pipelineValues);
68
  // }
69
  // }
 
70
  async function toggleLcmLive() {
71
  if (!isLCMRunning) {
72
  if (isImageMode) {
73
  await mediaStreamActions.enumerateDevices();
74
  await mediaStreamActions.start();
75
  }
 
76
  await lcmLiveActions.start();
 
77
  } else {
78
  if (isImageMode) {
79
  mediaStreamActions.stop();
@@ -126,7 +120,7 @@
126
  </header>
127
  <PipelineOptions {pipelineParams}></PipelineOptions>
128
  <div class="flex gap-3">
129
- <Button on:click={toggleLcmLive}>
130
  {#if isLCMRunning}
131
  Stop
132
  {:else}
 
15
  onFrameChangeStore,
16
  MediaStreamStatusEnum
17
  } from '$lib/mediaStream';
18
+ import { getPipelineValues } from '$lib/store';
19
 
20
  let pipelineParams: FieldProps[];
21
  let pipelineInfo: PipelineInfo;
 
33
  isImageMode = pipelineInfo.input_mode.default === PipelineMode.IMAGE;
34
  maxQueueSize = settings.max_queue_size;
35
  pipelineParams = pipelineParams.filter((e) => e?.disabled !== true);
 
 
36
  }
 
37
 
 
 
 
 
 
 
38
  // send Webcam stream to LCM if image mode
39
  $: {
40
  if (
 
42
  $lcmLiveStatus === LCMLiveStatus.CONNECTED &&
43
  $mediaStreamStatus === MediaStreamStatusEnum.CONNECTED
44
  ) {
45
+ lcmLiveActions.send(getPipelineValues());
46
  lcmLiveActions.send($onFrameChangeStore.blob);
47
  }
48
  }
 
58
  // lcmLiveActions.send($pipelineValues);
59
  // }
60
  // }
61
+ let disabled = false;
62
  async function toggleLcmLive() {
63
  if (!isLCMRunning) {
64
  if (isImageMode) {
65
  await mediaStreamActions.enumerateDevices();
66
  await mediaStreamActions.start();
67
  }
68
+ disabled = true;
69
  await lcmLiveActions.start();
70
+ disabled = false;
71
  } else {
72
  if (isImageMode) {
73
  mediaStreamActions.stop();
 
120
  </header>
121
  <PipelineOptions {pipelineParams}></PipelineOptions>
122
  <div class="flex gap-3">
123
+ <Button on:click={toggleLcmLive} {disabled}>
124
  {#if isLCMRunning}
125
  Stop
126
  {:else}
user_queue.py CHANGED
@@ -42,6 +42,13 @@ class UserData:
42
  return None
43
 
44
  def delete_user(self, user_id: UUID):
 
 
 
 
 
 
 
45
  if user_id in self.data_content:
46
  del self.data_content[user_id]
47
 
 
42
  return None
43
 
44
  def delete_user(self, user_id: UUID):
45
+ user_session = self.data_content[user_id]
46
+ queue = user_session["queue"]
47
+ while not queue.empty():
48
+ try:
49
+ queue.get_nowait()
50
+ except asyncio.QueueEmpty:
51
+ continue
52
  if user_id in self.data_content:
53
  del self.data_content[user_id]
54