forked from j62/ctbrec
Try not to write to sink, if the streamer has been stopped
This commit is contained in:
parent
17901901f9
commit
455dea97d9
|
@ -65,6 +65,7 @@ public class Streamer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
streamingShouldStop = true;
|
||||||
try {
|
try {
|
||||||
source.close();
|
source.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -75,7 +76,6 @@ public class Streamer {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Couldn't close sink", e);
|
log.error("Couldn't close sink", e);
|
||||||
}
|
}
|
||||||
streamingShouldStop = true;
|
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
bufferingThread.interrupt();
|
bufferingThread.interrupt();
|
||||||
streamingThread.interrupt();
|
streamingThread.interrupt();
|
||||||
|
@ -232,10 +232,12 @@ public class Streamer {
|
||||||
// Stream packet
|
// Stream packet
|
||||||
// System.out.println("Streaming packet #" + packetCount + ", PID=" + mtsPacket.getPid() + ", pcrCount=" + pcrCount + ", continuityCounter=" + mtsPacket.getContinuityCounter());
|
// System.out.println("Streaming packet #" + packetCount + ", PID=" + mtsPacket.getPid() + ", pcrCount=" + pcrCount + ", continuityCounter=" + mtsPacket.getContinuityCounter());
|
||||||
|
|
||||||
try {
|
if(!streamingShouldStop) {
|
||||||
sink.send(packet);
|
try {
|
||||||
} catch (Exception e) {
|
sink.send(packet);
|
||||||
log.error("Error sending packet to sink", e);
|
} catch (Exception e) {
|
||||||
|
log.error("Error sending packet to sink", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packetCount++;
|
packetCount++;
|
||||||
|
|
Loading…
Reference in New Issue