]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
if reconfiguration of the muxer fails, restart recording to a new file
authorJohn Törnblom <john.tornblom@gmail.com>
Mon, 26 Nov 2012 10:37:27 +0000 (11:37 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Tue, 27 Nov 2012 11:16:43 +0000 (12:16 +0100)
src/dvr/dvr_rec.c

index 48696d42cac9cc9592fb8defa8286a78eae4189e..7401dd32a715b6912bafa03f832d3577859d18ee 100755 (executable)
@@ -458,17 +458,25 @@ dvr_thread(void *aux)
       break;
 
     case SMT_START:
+      if(started &&
+        muxer_reconfigure(de->de_mux, sm->sm_data) < 0) {
+       tvhlog(LOG_WARNING,
+              "dvr", "Unable to reconfigure \"%s\"",
+              de->de_filename ?: lang_str_get(de->de_title, NULL));
+
+       // Try to restart the recording if the muxer doesn't
+       // support reconfiguration of the streams.
+       dvr_thread_epilog(de);
+       started = 0;
+      }
+
       if(!started) {
        pthread_mutex_lock(&global_lock);
        dvr_rec_set_state(de, DVR_RS_WAIT_PROGRAM_START, 0);
        if(dvr_rec_start(de, sm->sm_data) == 0)
          started = 1;
        pthread_mutex_unlock(&global_lock);
-      } else if(muxer_reconfigure(de->de_mux, sm->sm_data) < 0) {
-       tvhlog(LOG_WARNING,
-              "dvr", "Unable to reconfigure the recording \"%s\"",
-              de->de_filename ?: lang_str_get(de->de_title, NULL));
-      }
+      } 
       break;
 
     case SMT_STOP:
@@ -479,7 +487,6 @@ dvr_thread(void *aux)
         // Recording is completed
 
        de->de_last_error = 0;
-
        tvhlog(LOG_INFO, 
               "dvr", "Recording completed: \"%s\"",
               de->de_filename ?: lang_str_get(de->de_title, NULL));