Fix a crash when trying to get HLS fragments from a disconnected strema.
[cubemap] / stream.cpp
index 6a5ef99f78fa80a8294b6bf9d3bf8ee52d0bb1c0..3ee1a434d2e6fe6c3cc73fcc84d89d860efd0f05 100644 (file)
@@ -53,6 +53,7 @@ Stream::~Stream()
 
 Stream::Stream(const StreamProto &serialized, int data_fd)
        : url(serialized.url()),
+         unavailable(serialized.unavailable()),
          http_header(serialized.http_header()),
          stream_header(serialized.stream_header()),
          encoding(Stream::STREAM_ENCODING_RAW),  // Will be changed later.
@@ -84,6 +85,7 @@ Stream::Stream(const StreamProto &serialized, int data_fd)
 StreamProto Stream::serialize()
 {
        StreamProto serialized;
+       serialized.set_unavailable(unavailable);
        serialized.set_http_header(http_header);
        serialized.set_stream_header(stream_header);
        serialized.add_data_fds(data_fd);
@@ -154,6 +156,7 @@ void Stream::set_backlog_size(size_t new_size)
 
 void Stream::set_header(const std::string &new_http_header, const std::string &new_stream_header)
 {
+       unavailable = false;
        http_header = new_http_header;
        if (new_stream_header == stream_header) {
                return;