Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 774db49

Browse files
authored
Fix klocwork issues. (#659)
1 parent 99d60ac commit 774db49

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

talk/owt/sdk/base/customizedvideoencoderproxy.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int32_t CustomizedVideoEncoderProxy::Encode(
154154
for (int i = 0; i < 16; i++) {
155155
data_ptr[i + 7] = frame_number_sei_guid[i];
156156
}
157-
if (side_data_size > 0) {
157+
if (side_data_size > 0 && side_data_ptr) {
158158
memcpy(data_ptr + 23, side_data_ptr, side_data_size);
159159
encoder_buffer_handle->meta_data_.encoded_image_sidedata_free();
160160
}
@@ -203,7 +203,7 @@ int32_t CustomizedVideoEncoderProxy::Encode(
203203
data_ptr[i + 8] = frame_number_sei_guid[i];
204204
}
205205

206-
if (side_data_size > 0) {
206+
if (side_data_size > 0 && side_data_ptr) {
207207
memcpy(data_ptr + 24, side_data_ptr, side_data_size);
208208
encoder_buffer_handle->meta_data_.encoded_image_sidedata_free();
209209
}

talk/owt/sdk/base/desktopcapturer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ class BasicDesktopCapturer : public webrtc::VideoCaptureModule,
4242
rtc::VideoSinkInterface<webrtc::VideoFrame>* dataCallback) override {
4343
webrtc::MutexLock lock(&datacb_lock_);
4444
data_callback_ = dataCallback;
45+
return;
4546
}
4647
virtual void DeRegisterCaptureDataCallback() override {
4748
webrtc::MutexLock lock(&datacb_lock_);
4849
data_callback_ = nullptr;
50+
return;
4951
}
5052

5153
virtual int32_t StartCapture(

talk/owt/sdk/base/deviceutils.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ std::string DeviceUtils::GetDeviceNameByIndex(int index) {
161161
char unique_name[256];
162162
info->GetDeviceName(static_cast<uint32_t>(index), device_name,
163163
sizeof(device_name), unique_name, sizeof(unique_name));
164-
return std::string(device_name);
164+
const std::string device_str(device_name);
165+
return device_str;
165166
}
166167

167168
}

talk/owt/sdk/base/win/video_capture_mf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void VideoCaptureMF::IncomingFrame(IMFMediaBuffer*& frame, int64_t capture_time)
313313
}
314314

315315
// Retrieves the texture from dxgi buffer
316-
if (FAILED(dxgi_buffer->GetResource(IID_PPV_ARGS(&texture)))) {
316+
if (FAILED(dxgi_buffer->GetResource(IID_PPV_ARGS(&texture))) || texture == nullptr) {
317317
RTC_LOG(LS_ERROR) << "Retreiving the texture from dxgi buffer failed:"
318318
<< std::system_category().message(hr);
319319
return;

talk/owt/sdk/base/win/videorendererd3d11.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ bool WebrtcVideoRendererD3D11Impl::InitMPO(int width, int height) {
361361

362362
CComPtr<IDCompositionDesktopDevice> desktop_device;
363363
hr = DCompositionCreateDevice2(dxgi_device2_, IID_PPV_ARGS(&desktop_device));
364-
if (FAILED(hr))
364+
if (FAILED(hr) || !desktop_device.p)
365365
return false;
366366

367367
hr = desktop_device->QueryInterface(&comp_device2_);

0 commit comments

Comments
 (0)