void *);
int (*m_add_marker) (struct muxer *); // Add a marker (or chapter)
+ int m_eos; // End of stream
int m_errors; // Number of errors
muxer_container_type_t m_container; // The type of the container
muxer_config_t m_config; // general configuration
pm->m_errors++;
} else if(tvh_write(pm->pm_fd, data, size)) {
pm->pm_error = errno;
- if (errno == EPIPE) /* this is an end-of-streaming notification */
- return;
- tvhlog(LOG_ERR, "pass", "%s: Write failed -- %s", pm->pm_filename,
- strerror(errno));
+ if (errno != EPIPE)
+ tvhlog(LOG_ERR, "pass", "%s: Write failed -- %s", pm->pm_filename,
+ strerror(errno));
+ else
+ /* this is an end-of-streaming notification */
+ m->m_eos = 1;
m->m_errors++;
muxer_cache_update(m, pm->pm_fd, pm->pm_off, 0);
pm->pm_off = lseek(pm->pm_fd, 0, SEEK_CUR);
{
th_pkt_t *pkt = (th_pkt_t*)data;
tvh_muxer_t *tm = (tvh_muxer_t*)m;
+ int r;
assert(smt == SMT_PACKET);
- if(mk_mux_write_pkt(tm->tm_ref, pkt)) {
+ if((r = mk_mux_write_pkt(tm->tm_ref, pkt)) != 0) {
+ if (r == EPIPE)
+ tm->m_eos = 1;
tm->m_errors++;
return -1;
}
static void
mk_write_queue(mk_mux_t *mkm, htsbuf_queue_t *q)
{
- if(!mkm->error && mk_write_to_fd(mkm, q))
+ if(!mkm->error && mk_write_to_fd(mkm, q) && mkm->error != EPIPE)
tvhlog(LOG_ERR, "mkv", "%s: Write failed -- %s", mkm->filename,
strerror(errno));
streaming_msg_free(sm);
if(mux->m_errors) {
- tvhlog(LOG_WARNING, "webui", "Stop streaming %s, muxer reported errors", hc->hc_url_orig);
+ if (!mux->m_eos)
+ tvhlog(LOG_WARNING, "webui", "Stop streaming %s, muxer reported errors", hc->hc_url_orig);
run = 0;
}
}