[Bug 773665] playbin cannot recover from network interruption while streaming a live HTTP stream
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Sat Oct 29 10:20:16 UTC 2016
https://bugzilla.gnome.org/show_bug.cgi?id=773665
--- Comment #1 from Eric Toombs <ewtoombs at uwaterloo.ca> ---
Comment on attachment 338770
--> https://bugzilla.gnome.org/attachment.cgi?id=338770
starts a command upon receipt of HTTP GET and returns the result.
>#!/usr/bin/env python
>
>from socketserver import TCPServer
>from http.server import BaseHTTPRequestHandler
>import subprocess as sp
>from sys import *
>
>class ToddHandler(BaseHTTPRequestHandler):
> def do_GET(self):
> stderr.write('Client has connected.\n')
> self.send_response(200)
> self.end_headers()
> p = sp.Popen(argv[1:], stdout=sp.PIPE)
> while True:
> data = p.stdout.read(1024)
> if len(data) == 0:
> break
>
> try:
> self.wfile.write(data)
> except BrokenPipeError:
> break
> except ConnectionResetError:
> break
> stderr.write('Client has disconnected.\n')
> p.stdout.close()
> # The previous call is enough to stop the command, but it will be a
> # zombie until after the exit code is read. This is what this last
> # p.wait() call is for. DIE ZOMBIES!!
> p.wait()
>
>if len(argv) == 1:
> stderr.write('usage: todd command [arg1 arg2 ...]\n')
> exit(1)
>
># Create the server.
>server = TCPServer(('', 10000), ToddHandler)
>
># Activate the server; this will keep running until you
># interrupt the program with Ctrl-C
>server.serve_forever()
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list