Skip to content

Commit

Permalink
映像の受信が落ちなくなった (緑の画面が表示される)
Browse files Browse the repository at this point in the history
  • Loading branch information
enm10k committed Oct 5, 2023
1 parent 590a748 commit d70784c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/hwenc_jetson/jetson_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ rtc::scoped_refptr<webrtc::I420BufferInterface> JetsonBuffer::ToI420() {
}
for (int i = 0; i < height; i++) {
memcpy(dest_addr + width * i,
(uint8_t*)data_addr + dst_surface->surfaceList->pitch * i,
(uint8_t*)data_addr +
dst_surface->surfaceList->planeParams.pitch[i] * i,
width);
}
}
Expand Down
10 changes: 4 additions & 6 deletions src/hwenc_jetson/jetson_video_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ bool JetsonVideoDecoder::JetsonRelease() {
}
if (dst_surface_ != nullptr) {
NvBufSurfaceDestroy(dst_surface_);
dst_surface_ = nullptr;
}
return true;
}
Expand Down Expand Up @@ -419,21 +420,18 @@ int JetsonVideoDecoder::SetCapture() {

if (dst_surface_ != nullptr) {
NvBufSurfaceDestroy(dst_surface_);
dst_surface_ = nullptr;
}

NvBufSurfaceAllocateParams input_params = {0};
input_params.params.width = capture_crop_->c.width;
input_params.params.height = capture_crop_->c.height;
input_params.params.layout = NVBUF_LAYOUT_PITCH;
input_params.params.colorFormat = NVBUF_COLOR_FORMAT_YUV420;
input_params.params.memType = NVBUF_MEM_SURFACE_ARRAY;
input_params.memtag = NvBufSurfaceTag_VIDEO_DEC;

dst_surface_ = new NvBufSurface;
dst_surface_->memType = NVBUF_MEM_SURFACE_ARRAY;

NvBufSurface* dst_surfaces[] = {dst_surface_};

ret = NvBufSurfaceAllocate(dst_surfaces, 1, &input_params);
ret = NvBufSurfaceAllocate(&dst_surface_, 1, &input_params);
INIT_ERROR(ret == -1, "failed to NvBufSurfaceAllocate");

decoder_->capture_plane.deinitPlane();
Expand Down

0 comments on commit d70784c

Please sign in to comment.