Loading src/camogm_align.c +4 −1 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ static inline size_t align_bytes_num(size_t data_len, size_t align_len) return align_len - rem; } /** Remap vectors pointing to various buffers with frame data to vectors used during frame alignment */ static void remap_vectors(camogm_state *state, struct iovec *chunks) { int chunk_index = 1; Loading Loading @@ -177,6 +178,7 @@ static size_t get_blocks_num(struct iovec *sgl, size_t n_elem) return total / PHY_BLOCK_SIZE; } /** Allocate and initialize buffers for frame alignment */ int init_align_buffers(camogm_state *state) { state->writer_params.data_chunks = (struct iovec *)malloc(MAX_DATA_CHUNKS * sizeof(struct iovec)); Loading Loading @@ -211,6 +213,7 @@ int init_align_buffers(camogm_state *state) return 0; } /** Delete buffers for frame alignment */ void deinit_align_buffers(camogm_state *state) { struct writer_params *params = &state->writer_params; Loading Loading @@ -408,7 +411,6 @@ void align_frame(camogm_state *state) } else { /* the frame is aligned to sector boundary but some buffers may be not */ chunks[CHUNK_ALIGN].iov_base = vectrpos(cbuff, 0); // chunks[CHUNK_ALIGN].iov_dma = cbuff->iov_dma + cbuff->iov_len; chunks[CHUNK_ALIGN].iov_len = 0; if (chunks[CHUNK_DATA_1].iov_len == 0) { data_len = chunks[CHUNK_DATA_0].iov_len % ALIGNMENT_SIZE; Loading Loading @@ -510,6 +512,7 @@ int prep_last_block(camogm_state *state) return ret; } /** Convert LBA to byte offset used for lseek */ off64_t lba_to_offset(uint64_t lba) { return lba * PHY_BLOCK_SIZE; Loading src/camogm_jpeg.c +1 −10 Original line number Diff line number Diff line Loading @@ -329,6 +329,7 @@ int camogm_frame_jpeg(camogm_state *state) align_frame(state); if (update_lba(state) == 1) { D0(fprintf(debug_file, "The end of block device reached, continue recording from start\n")); lseek(state->writer_params.blockdev_fd, 0, SEEK_SET); } D6(fprintf(debug_file, "Block device positions: start = %llu, current = %llu, end = %llu\n", state->writer_params.lba_start, state->writer_params.lba_current, state->writer_params.lba_end)); Loading @@ -342,10 +343,6 @@ int camogm_frame_jpeg(camogm_state *state) if (state->writer_params.last_ret_val != 0) { return state->writer_params.last_ret_val; } // update statistics // state->rawdev.last_jpeg_size = camogm_get_jpeg_size(state); // state->rawdev.total_rec_len += state->rawdev.last_jpeg_size; } return 0; Loading Loading @@ -424,12 +421,6 @@ void *jpeg_writer(void *thread_args) if (params->data_ready) { l = 0; state->writer_params.last_ret_val = 0; // for (int i = 0; i < (state->chunk_index) - 1; i++) { // chunks_iovec[i].iov_base = state->packetchunks[i + 1].chunk; // chunks_iovec[i].iov_len = state->packetchunks[i + 1].bytes; // l += chunks_iovec[i].iov_len; // } // chunk_index = state->chunk_index; chunk_index = get_data_buffers(state, &chunks_iovec, FILE_CHUNKS_NUM); if (chunk_index > 0) { for (int i = 0; i < chunk_index; i++) Loading Loading
src/camogm_align.c +4 −1 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ static inline size_t align_bytes_num(size_t data_len, size_t align_len) return align_len - rem; } /** Remap vectors pointing to various buffers with frame data to vectors used during frame alignment */ static void remap_vectors(camogm_state *state, struct iovec *chunks) { int chunk_index = 1; Loading Loading @@ -177,6 +178,7 @@ static size_t get_blocks_num(struct iovec *sgl, size_t n_elem) return total / PHY_BLOCK_SIZE; } /** Allocate and initialize buffers for frame alignment */ int init_align_buffers(camogm_state *state) { state->writer_params.data_chunks = (struct iovec *)malloc(MAX_DATA_CHUNKS * sizeof(struct iovec)); Loading Loading @@ -211,6 +213,7 @@ int init_align_buffers(camogm_state *state) return 0; } /** Delete buffers for frame alignment */ void deinit_align_buffers(camogm_state *state) { struct writer_params *params = &state->writer_params; Loading Loading @@ -408,7 +411,6 @@ void align_frame(camogm_state *state) } else { /* the frame is aligned to sector boundary but some buffers may be not */ chunks[CHUNK_ALIGN].iov_base = vectrpos(cbuff, 0); // chunks[CHUNK_ALIGN].iov_dma = cbuff->iov_dma + cbuff->iov_len; chunks[CHUNK_ALIGN].iov_len = 0; if (chunks[CHUNK_DATA_1].iov_len == 0) { data_len = chunks[CHUNK_DATA_0].iov_len % ALIGNMENT_SIZE; Loading Loading @@ -510,6 +512,7 @@ int prep_last_block(camogm_state *state) return ret; } /** Convert LBA to byte offset used for lseek */ off64_t lba_to_offset(uint64_t lba) { return lba * PHY_BLOCK_SIZE; Loading
src/camogm_jpeg.c +1 −10 Original line number Diff line number Diff line Loading @@ -329,6 +329,7 @@ int camogm_frame_jpeg(camogm_state *state) align_frame(state); if (update_lba(state) == 1) { D0(fprintf(debug_file, "The end of block device reached, continue recording from start\n")); lseek(state->writer_params.blockdev_fd, 0, SEEK_SET); } D6(fprintf(debug_file, "Block device positions: start = %llu, current = %llu, end = %llu\n", state->writer_params.lba_start, state->writer_params.lba_current, state->writer_params.lba_end)); Loading @@ -342,10 +343,6 @@ int camogm_frame_jpeg(camogm_state *state) if (state->writer_params.last_ret_val != 0) { return state->writer_params.last_ret_val; } // update statistics // state->rawdev.last_jpeg_size = camogm_get_jpeg_size(state); // state->rawdev.total_rec_len += state->rawdev.last_jpeg_size; } return 0; Loading Loading @@ -424,12 +421,6 @@ void *jpeg_writer(void *thread_args) if (params->data_ready) { l = 0; state->writer_params.last_ret_val = 0; // for (int i = 0; i < (state->chunk_index) - 1; i++) { // chunks_iovec[i].iov_base = state->packetchunks[i + 1].chunk; // chunks_iovec[i].iov_len = state->packetchunks[i + 1].bytes; // l += chunks_iovec[i].iov_len; // } // chunk_index = state->chunk_index; chunk_index = get_data_buffers(state, &chunks_iovec, FILE_CHUNKS_NUM); if (chunk_index > 0) { for (int i = 0; i < chunk_index; i++) Loading