@@ -46,11 +46,8 @@ std::size_t computeBufferSize(int width, int height, VideoBufferType type) {
4646 return w * h * 4 ;
4747
4848 case VideoBufferType::RGB24:
49- // 3 bytes per pixel
50- return w * h * 3 ;
51-
5249 case VideoBufferType::I444:
53- // Y, U, V all full resolution
50+ // 3 bytes per pixel (RGB24: packed; I444: Y+U+ V all full resolution)
5451 return w * h * 3 ;
5552
5653 case VideoBufferType::I420:
@@ -295,7 +292,7 @@ VideoFrame::VideoFrame(int width, int height, VideoBufferType type,
295292VideoFrame VideoFrame::create (int width, int height, VideoBufferType type) {
296293 const std::size_t size = computeBufferSize (width, height, type);
297294 std::vector<std::uint8_t > buffer (size, 0 );
298- return VideoFrame ( width, height, type, std::move (buffer)) ;
295+ return { width, height, type, std::move (buffer)} ;
299296}
300297
301298std::vector<VideoPlaneInfo> VideoFrame::planeInfos () const {
@@ -315,7 +312,7 @@ VideoFrame VideoFrame::convert(VideoBufferType dst, bool flip_y) const {
315312 LK_LOG_WARN (" VideoFrame::convert: converting to the same format" );
316313 // copy pixel data
317314 std::vector<std::uint8_t > buf = data_;
318- return VideoFrame ( width_, height_, type_, std::move (buf)) ;
315+ return { width_, height_, type_, std::move (buf)} ;
319316 }
320317
321318 // General path: delegate to the FFI-based conversion helper.
@@ -342,15 +339,15 @@ VideoFrame VideoFrame::fromOwnedInfo(const proto::OwnedVideoBuffer &owned) {
342339 std::size_t offset = 0 ;
343340 for (const auto &comp : info.components ()) {
344341 const auto sz = static_cast <std::size_t >(comp.size ());
345- const auto src_ptr = reinterpret_cast <const std::uint8_t *>(
342+ const auto src_ptr = reinterpret_cast <const std::uint8_t *>( // NOLINT(performance-no-int-to-ptr)
346343 static_cast <std::uintptr_t >(comp.data_ptr ()));
347344
348345 std::memcpy (buffer.data () + offset, src_ptr, sz);
349346 offset += sz;
350347 }
351348 } else {
352349 // Packed format: treat top-level data_ptr as a single contiguous buffer.
353- const auto src_ptr = reinterpret_cast <const std::uint8_t *>(
350+ const auto src_ptr = reinterpret_cast <const std::uint8_t *>( // NOLINT(performance-no-int-to-ptr)
354351 static_cast <std::uintptr_t >(info.data_ptr ()));
355352
356353 std::size_t total_size = 0 ;
@@ -373,7 +370,7 @@ VideoFrame VideoFrame::fromOwnedInfo(const proto::OwnedVideoBuffer &owned) {
373370 // owned_handle destroyed at end of scope → native buffer disposed.
374371 }
375372
376- return VideoFrame ( width, height, type, std::move (buffer)) ;
373+ return { width, height, type, std::move (buffer)} ;
377374}
378375
379376} // namespace livekit
0 commit comments