]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
muxers: do not show EPIPE as an error
authorJaroslav Kysela <perex@perex.cz>
Thu, 26 Jun 2014 19:22:30 +0000 (21:22 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 26 Jun 2014 19:23:21 +0000 (21:23 +0200)
src/muxer.h
src/muxer/muxer_pass.c
src/muxer/muxer_tvh.c
src/muxer/tvh/mkmux.c
src/webui/webui.c

index 1c0a85aec35b14ea6a6c4b6b3e1438995791fad4..223f5d3416140d00c9da1a2c5facf7156d601504 100644 (file)
@@ -81,6 +81,7 @@ typedef struct muxer {
                               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
index 6a9fe1686e40ac6d8c394970a588d6d05b549bb0..68483d2a68afedb57eefbffa4b708d6bd1d3d540 100644 (file)
@@ -401,10 +401,12 @@ pass_muxer_write(muxer_t *m, const void *data, size_t size)
     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);
index 715328ce56c189af951a9af57244e0d3603631d2..4c38bb0de0730eeef7f4eb51d336256840ff26d1 100644 (file)
@@ -155,10 +155,13 @@ tvh_muxer_write_pkt(muxer_t *m, streaming_message_type_t smt, void *data)
 {
   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;
   }
index 5f366717c347abcf0876c4b899e1433feec5d9a7..134021b1aa720b023bd0d500db807877d2fd3bed 100644 (file)
@@ -462,7 +462,7 @@ mk_write_to_fd(mk_mux_t *mkm, htsbuf_queue_t *hq)
 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));
 
index d1123db4564a30583f1d097b4d9b72d8f923b638..d02a1b454187457e0811e92c2f7eec444497a8fe 100644 (file)
@@ -339,7 +339,8 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq,
     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;
     }
   }