    return util::string_format("%s%s/%d/%s.hevc", BASE_URL, route_name.c_str(), segment_num, camera.c_str());
  }
  
  void camera_init(VisionIpcServer *v, CameraState *s, int camera_id, unsigned int fps, cl_device_id device_id, cl_context ctx, VisionStreamType rgb_type, VisionStreamType yuv_type, const std::string &url) {
    s->frame = new FrameReader(true);
    if (!s->frame->load(url)) {
      printf("failed to load stream from %s", url.c_str());
      assert(0);
    }
  
 
</s> remove bool FrameReader::load(const std::string &url, bool no_cuda, std::atomic<bool> *abort) {
  std::string content = read(url, abort);
  if (content.empty()) return false;
 </s> add bool FrameReader::load(const std::string &url, bool no_cuda, std::atomic<bool> *abort, bool local_cache, int chunk_size, int retries) {
  FileReader f(local_cache, chunk_size, retries);
  std::string data = f.read(url, abort);
  if (data.empty()) return false;

  return load((std::byte *)data.data(), data.size(), no_cuda, abort);
} </s> remove     printf("Error loading video - %s - %s\n", err_str, url.c_str());
 </s> add     printf("Error loading video - %s\n", err_str); </s> remove     .data = (uint8_t *)content.data(),
 </s> add     .data = (const uint8_t*)data, </s> remove FrameReader::FrameReader(bool local_cache, int chunk_size, int retries) : FileReader(local_cache, chunk_size, retries) {
}
 </s> add FrameReader::FrameReader() {}
  s->frame = new FrameReader();
    return util::string_format("%s%s/%d/%s.hevc", BASE_URL, route_name.c_str(), segment_num, camera.c_str());
  }
  
  void camera_init(VisionIpcServer *v, CameraState *s, int camera_id, unsigned int fps, cl_device_id device_id, cl_context ctx, VisionStreamType rgb_type, VisionStreamType yuv_type, const std::string &url) {
  s->frame = new FrameReader();
    if (!s->frame->load(url)) {
      printf("failed to load stream from %s", url.c_str());
      assert(0);
    }
  
keep keep keep keep replace keep keep keep keep keep
 logreader: support reading from corrupt log (#23050)

* catch exception outside loop

* print decompress error

* add test case for corrupt log

* fix decompressbz2 stuck if log is corrupt

* recovered from corrupt data

* add output

* ass space

* std::endl

* override load(), load from buffer

* override FrameReader::load to load from the buffer

* replace NULL with nullptr

* fix test case for corrupt log

* Trigger Build

* check bzerror too

Co-authored-by: Willem Melching <willem.melching@gmail.com> 
selfdrive/camerad/cameras/camera_replay.cc