Spaces:
Build error
Build error
Update webapp.py
Browse files
webapp.py
CHANGED
|
@@ -280,13 +280,27 @@ class DemoCase:
|
|
| 280 |
while True:
|
| 281 |
if self._is_running:
|
| 282 |
if self.stream0 is None:
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
|
| 291 |
try:
|
| 292 |
# loop over frames
|
|
@@ -386,13 +400,27 @@ class DemoCase:
|
|
| 386 |
while True:
|
| 387 |
if self._is_running:
|
| 388 |
if self.stream1 is None:
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
|
| 397 |
if (self._is_tracking and self.stream1 is not None):
|
| 398 |
if self.counter is None or self._roi_changed:
|
|
|
|
| 280 |
while True:
|
| 281 |
if self._is_running:
|
| 282 |
if self.stream0 is None:
|
| 283 |
+
try:
|
| 284 |
+
# Start the stream, set desired resolution to be 720p
|
| 285 |
+
options = {"STREAM_RESOLUTION": "720p"}
|
| 286 |
+
self.stream0 = CamGear(
|
| 287 |
+
source=self.url_dict[self.cam_loc],
|
| 288 |
+
colorspace=None,
|
| 289 |
+
stream_mode=True,
|
| 290 |
+
logging=True,
|
| 291 |
+
**options
|
| 292 |
+
).start()
|
| 293 |
+
except:
|
| 294 |
+
# Start the stream, set best resolution
|
| 295 |
+
self.stream0 = CamGear(
|
| 296 |
+
source=self.url_dict[self.cam_loc],
|
| 297 |
+
colorspace=None,
|
| 298 |
+
stream_mode=True,
|
| 299 |
+
logging=True
|
| 300 |
+
).start()
|
| 301 |
+
logging.warning(
|
| 302 |
+
"failed to connect {self.url_dict[self.cam_loc]} at 720p resolution, use best resolution"
|
| 303 |
+
)
|
| 304 |
|
| 305 |
try:
|
| 306 |
# loop over frames
|
|
|
|
| 400 |
while True:
|
| 401 |
if self._is_running:
|
| 402 |
if self.stream1 is None:
|
| 403 |
+
try:
|
| 404 |
+
# Start the stream, set desired quality as 720p
|
| 405 |
+
options = {"STREAM_RESOLUTION": "720p"}
|
| 406 |
+
self.stream1 = CamGear(
|
| 407 |
+
source=self.url_dict[self.cam_loc],
|
| 408 |
+
colorspace=None,
|
| 409 |
+
stream_mode=True,
|
| 410 |
+
logging=True,
|
| 411 |
+
**options
|
| 412 |
+
).start()
|
| 413 |
+
except:
|
| 414 |
+
# Start the stream, use the best resolution
|
| 415 |
+
self.stream1 = CamGear(
|
| 416 |
+
source=self.url_dict[self.cam_loc],
|
| 417 |
+
colorspace=None,
|
| 418 |
+
stream_mode=True,
|
| 419 |
+
logging=True
|
| 420 |
+
).start()
|
| 421 |
+
logging.warning(
|
| 422 |
+
"failed to connect {self.url_dict[self.cam_loc]} at 720p resolution, use best resolution"
|
| 423 |
+
)
|
| 424 |
|
| 425 |
if (self._is_tracking and self.stream1 is not None):
|
| 426 |
if self.counter is None or self._roi_changed:
|