| 
						
						
						
					 | 
					 | 
					@ -1,3 +1,5 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#include <cassert> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "system/loggerd/loggerd.h" | 
					 | 
					 | 
					 | 
					#include "system/loggerd/loggerd.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#ifdef QCOM2 | 
					 | 
					 | 
					 | 
					#ifdef QCOM2 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -59,15 +61,10 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (encoders.empty()) { | 
					 | 
					 | 
					 | 
					    if (encoders.empty()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      VisionBuf buf_info = vipc_client.buffers[0]; | 
					 | 
					 | 
					 | 
					      VisionBuf buf_info = vipc_client.buffers[0]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      LOGW("encoder %s init %dx%d", cam_info.thread_name, buf_info.width, buf_info.height); | 
					 | 
					 | 
					 | 
					      LOGW("encoder %s init %dx%d", cam_info.thread_name, buf_info.width, buf_info.height); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      assert(buf_info.width > 0 && buf_info.height > 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (buf_info.width > 0 && buf_info.height > 0) { | 
					 | 
					 | 
					 | 
					      for (const auto &encoder_info : cam_info.encoder_infos) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (const auto &encoder_info: cam_info.encoder_infos){ | 
					 | 
					 | 
					 | 
					        encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height)); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } else { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        LOGE("not initting empty encoder"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        s->max_waiting--; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        break; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -127,12 +124,27 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void encoderd_thread() { | 
					 | 
					 | 
					 | 
					void encoderd_thread() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  EncoderdState s; | 
					 | 
					 | 
					 | 
					  EncoderdState s; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  std::vector<std::thread> encoder_threads; | 
					 | 
					 | 
					 | 
					  std::set<VisionStreamType> streams; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for (const auto &cam : cameras_logged) { | 
					 | 
					 | 
					 | 
					  while (!do_exit) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    encoder_threads.push_back(std::thread(encoder_thread, &s, cam)); | 
					 | 
					 | 
					 | 
					    streams = VisionIpcClient::getAvailableStreams("camerad", false); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    s.max_waiting++; | 
					 | 
					 | 
					 | 
					    if (!streams.empty()) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    util::sleep_for(100); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if (!streams.empty()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    std::vector<std::thread> encoder_threads; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    for (auto stream : streams) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      auto it = std::find_if(std::begin(cameras_logged), std::end(cameras_logged), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                             [stream](auto &cam) { return cam.stream_type == stream; }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      assert(it != std::end(cameras_logged)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      ++s.max_waiting; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      encoder_threads.push_back(std::thread(encoder_thread, &s, *it)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    for (auto &t : encoder_threads) t.join(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for (auto &t : encoder_threads) t.join(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					int main() { | 
					 | 
					 | 
					 | 
					int main() { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |