Take web socket downloads into account for the bandwidth meter
This commit is contained in:
parent
de9c11baf5
commit
8b6b96c606
|
@ -3,6 +3,7 @@ package ctbrec.sites.secretfriends;
|
|||
import ctbrec.Config;
|
||||
import ctbrec.Model;
|
||||
import ctbrec.Recording;
|
||||
import ctbrec.io.BandwidthMeter;
|
||||
import ctbrec.io.HttpClient;
|
||||
import ctbrec.recorder.download.AbstractDownload;
|
||||
import ctbrec.recorder.download.Download;
|
||||
|
@ -172,7 +173,9 @@ public class SecretFriendsWebrtcDownload extends AbstractDownload {
|
|||
super.onMessage(webSocket, bytes);
|
||||
timeOfLastTransfer = Instant.now();
|
||||
try {
|
||||
fout.write(bytes.toByteArray());
|
||||
byte[] videoData = bytes.toByteArray();
|
||||
fout.write(videoData);
|
||||
BandwidthMeter.add(videoData.length);
|
||||
} catch (IOException e) {
|
||||
if (running) {
|
||||
LOG.error("Couldn't write video stream to file", e);
|
||||
|
|
|
@ -3,6 +3,7 @@ package ctbrec.sites.showup;
|
|||
import ctbrec.Config;
|
||||
import ctbrec.Model;
|
||||
import ctbrec.Recording;
|
||||
import ctbrec.io.BandwidthMeter;
|
||||
import ctbrec.io.HttpClient;
|
||||
import ctbrec.recorder.download.AbstractDownload;
|
||||
import ctbrec.recorder.download.Download;
|
||||
|
@ -167,7 +168,9 @@ public class ShowupWebrtcDownload extends AbstractDownload {
|
|||
super.onMessage(webSocket, bytes);
|
||||
timeOfLastTransfer = Instant.now();
|
||||
try {
|
||||
fout.write(bytes.toByteArray());
|
||||
byte[] videoData = bytes.toByteArray();
|
||||
fout.write(videoData);
|
||||
BandwidthMeter.add(videoData.length);
|
||||
} catch (IOException e) {
|
||||
if (running) {
|
||||
LOG.error("Couldn't write video stream to file", e);
|
||||
|
|
Loading…
Reference in New Issue