|
发表于 2024-4-30 17:56:06
只看该作者
5#
这样按字节打印是有数据。但是 shared_ptr<VideoBuffer> buf = static_pointer_cast<VideoBuffer>(buffer);
char* char_data = static_cast<char*>(buf->getActiveData());
std::vector<char> videobuffer(char_data, char_data + buf->getActiveSize());
// 分块处理数据
for (size_t i = 0; i < videobuffer.size(); i += BUFFER_SIZE) {
size_t chunk_size = std::min(BUFFER_SIZE, videobuffer.size() - i);
std::cout <<"chunk_size: "<< chunk_size << std::endl;
// std::cout <<"videobuffer.data(): "<< videobuffer.data() << std::endl;
shared_memory.writeData(videobuffer.data() + i, chunk_size);
}这个有错误吗?写入的数据是一个空 |
|