mirror of
				https://github.com/AlexxIT/go2rtc.git
				synced 2025-10-31 11:46:26 +08:00 
			
		
		
		
	Fix writers for MJPEG and ASCII
This commit is contained in:
		| @@ -136,11 +136,13 @@ func (a *writer) Write(p []byte) (n int, err error) { | |||||||
|  |  | ||||||
| 	a.buf = append(a.buf, "\033[0m"...) | 	a.buf = append(a.buf, "\033[0m"...) | ||||||
|  |  | ||||||
| 	if n, err = a.wr.Write(a.buf); err == nil { | 	if _, err = a.wr.Write(a.buf); err != nil { | ||||||
| 		a.wr.(http.Flusher).Flush() | 		return 0, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return | 	a.wr.(http.Flusher).Flush() | ||||||
|  |  | ||||||
|  | 	return len(p), nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func gray(r, g, b uint32, k float32) uint8 { | func gray(r, g, b uint32, k float32) uint8 { | ||||||
|   | |||||||
| @@ -28,9 +28,11 @@ func (w *writer) Write(p []byte) (n int, err error) { | |||||||
|  |  | ||||||
| 	// Chrome bug: mjpeg image always shows the second to last image | 	// Chrome bug: mjpeg image always shows the second to last image | ||||||
| 	// https://bugs.chromium.org/p/chromium/issues/detail?id=527446 | 	// https://bugs.chromium.org/p/chromium/issues/detail?id=527446 | ||||||
| 	if n, err = w.wr.Write(w.buf); err == nil { | 	if _, err = w.wr.Write(w.buf); err != nil { | ||||||
| 		w.wr.(http.Flusher).Flush() | 		return 0, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return | 	w.wr.(http.Flusher).Flush() | ||||||
|  |  | ||||||
|  | 	return len(p), nil | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alex X
					Alex X