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

Commit 9891ec1

Browse files
committed
Address review comments
1 parent f15ce96 commit 9891ec1

16 files changed

+441
-612
lines changed

talk/owt/sdk/base/cameravideocapturer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void CameraVideoCapturer::OnFrame(const webrtc::VideoFrame& frame) {
3636
return;
3737
}
3838

39-
if (false/*out_height != frame.height() || out_width != frame.width()*/) {
39+
if (out_height != frame.height() || out_width != frame.width()) {
4040
// Video adapter has requested a down-scale. Allocate a new buffer and
4141
// return scaled version.
4242
rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer =

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

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
namespace owt {
1515
namespace base {
1616

17-
std::mutex MediaCapabilities::get_singleton_mutex;
18-
MediaCapabilities* MediaCapabilities::singleton = nullptr;
17+
std::mutex MediaCapabilities::get_singleton_mutex_;
18+
MediaCapabilities* MediaCapabilities::singleton_ = nullptr;
1919

2020
std::vector<VideoEncoderCapability>
2121
MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
@@ -53,8 +53,8 @@ MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
5353

5454
std::vector<VideoEncoderCapability> capabilities;
5555
// Check platform type.
56-
if (inited) {
57-
unsigned short platform_code = mfx_platform.CodeName;
56+
if (inited_) {
57+
unsigned short platform_code = mfx_platform_.CodeName;
5858
if (platform_code >= MFX_PLATFORM_HASWELL) {
5959
support_h264 = true;
6060
if (platform_code > MFX_PLATFORM_BROADWELL)
@@ -74,7 +74,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
7474
}
7575
#endif
7676
#if (MFX_VERSION >= 1031)
77-
if (mfx_platform.MediaAdapterType == MFX_MEDIA_DISCRETE)
77+
if (mfx_platform_.MediaAdapterType == MFX_MEDIA_DISCRETE)
7878
is_discrete_graphics = true;
7979
#endif
8080
// Query platform capability for specific codec. Only check for
@@ -87,14 +87,14 @@ MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
8787
memset(&video_param, 0, sizeof(video_param));
8888
video_param.mfx.CodecId = MFX_CODEC_VP9;
8989
video_param.mfx.CodecProfile = MFX_PROFILE_VP9_0;
90-
sts = mfx_encoder->Query(nullptr, &video_param);
90+
sts = mfx_encoder_->Query(nullptr, &video_param);
9191
if (sts != MFX_ERR_NONE)
9292
support_vp9_8 &= false;
9393

9494
memset(&video_param, 0, sizeof(video_param));
9595
video_param.mfx.CodecId = MFX_CODEC_VP9;
9696
video_param.mfx.CodecProfile = MFX_PROFILE_VP9_2;
97-
sts = mfx_encoder->Query(nullptr, &video_param);
97+
sts = mfx_encoder_->Query(nullptr, &video_param);
9898
if (sts != MFX_ERR_NONE)
9999
support_vp9_10 &= false;
100100

@@ -144,14 +144,14 @@ MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
144144
// load plugins here.
145145
video_param.mfx.CodecId = MFX_CODEC_HEVC;
146146
video_param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN;
147-
sts = mfx_encoder->Query(nullptr, &video_param);
147+
sts = mfx_encoder_->Query(nullptr, &video_param);
148148
if (sts != MFX_ERR_NONE)
149149
support_hevc_8 &= false;
150150

151151
memset(&video_param, 0, sizeof(video_param));
152152
video_param.mfx.CodecId = MFX_CODEC_HEVC;
153153
video_param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN10;
154-
sts = mfx_encoder->Query(nullptr, &video_param);
154+
sts = mfx_encoder_->Query(nullptr, &video_param);
155155
if (sts != MFX_ERR_NONE)
156156
support_hevc_10 &= false;
157157

@@ -160,7 +160,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
160160
memset(&video_param, 0, sizeof(video_param));
161161
video_param.mfx.CodecId = MFX_CODEC_HEVC;
162162
video_param.mfx.CodecProfile = MFX_PROFILE_HEVC_SCC;
163-
sts = mfx_encoder->Query(nullptr, &video_param);
163+
sts = mfx_encoder_->Query(nullptr, &video_param);
164164
if (sts == MFX_ERR_NONE)
165165
support_hevc_scc = true;
166166
#endif
@@ -224,7 +224,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoEncoder(
224224
memset(&video_param, 0, sizeof(video_param));
225225
video_param.mfx.CodecId = MFX_CODEC_AVC;
226226
// Don't check profiles. We know we can support from CB up to High.
227-
sts = mfx_encoder->Query(nullptr, &video_param);
227+
sts = mfx_encoder_->Query(nullptr, &video_param);
228228
if (sts != MFX_ERR_NONE)
229229
support_h264 &= false;
230230

@@ -255,11 +255,11 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
255255
std::vector<owt::base::VideoCodec>& codec_types) {
256256
std::vector<VideoDecoderCapability> capabilities;
257257

258-
if (inited) {
258+
if (inited_) {
259259
mfxStatus sts = MFX_ERR_NONE;
260260
mfxVideoParam video_param;
261261

262-
unsigned short platform_code = mfx_platform.CodeName;
262+
unsigned short platform_code = mfx_platform_.CodeName;
263263
for (auto& codec : codec_types) {
264264
if (codec == owt::base::VideoCodec::kVp9) {
265265
if (platform_code < MFX_PLATFORM_KABYLAKE)
@@ -268,7 +268,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
268268
memset(&video_param, 0, sizeof(video_param));
269269
video_param.mfx.CodecId = MFX_CODEC_VP9;
270270

271-
sts = mfx_decoder->Query(nullptr, &video_param);
271+
sts = mfx_decoder_->Query(nullptr, &video_param);
272272
if (sts == MFX_ERR_NONE) {
273273
VideoDecoderCapability vp9_cap;
274274
vp9_cap.codec_type = owt::base::VideoCodec::kVp9;
@@ -283,7 +283,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
283283
memset(&video_param, 0, sizeof(video_param));
284284
video_param.mfx.CodecId = MFX_CODEC_AVC;
285285

286-
sts = mfx_decoder->Query(nullptr, &video_param);
286+
sts = mfx_decoder_->Query(nullptr, &video_param);
287287
if (sts == MFX_ERR_NONE) {
288288
VideoDecoderCapability avc_cap;
289289
avc_cap.codec_type = owt::base::VideoCodec::kH264;
@@ -296,7 +296,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
296296
else if (codec == owt::base::VideoCodec::kH265) {
297297
memset(&video_param, 0, sizeof(video_param));
298298
video_param.mfx.CodecId = MFX_CODEC_HEVC;
299-
sts = mfx_decoder->Query(nullptr, &video_param);
299+
sts = mfx_decoder_->Query(nullptr, &video_param);
300300
RTC_LOG(LS_ERROR) << "Johny---H265 query result:" << sts;
301301

302302
if (sts == MFX_ERR_NONE) {
@@ -321,7 +321,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
321321
memset(&video_param, 0, sizeof(video_param));
322322
video_param.mfx.CodecId = MFX_CODEC_AV1;
323323

324-
sts = mfx_decoder->Query(nullptr, &video_param);
324+
sts = mfx_decoder_->Query(nullptr, &video_param);
325325
if (sts == MFX_ERR_NONE) {
326326
VideoDecoderCapability av1_cap;
327327
av1_cap.codec_type = owt::base::VideoCodec::kAv1;
@@ -336,7 +336,7 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
336336
memset(&video_param, 0, sizeof(video_param));
337337
video_param.mfx.CodecId = MFX_CODEC_VP8;
338338

339-
sts = mfx_decoder->Query(nullptr, &video_param);
339+
sts = mfx_decoder_->Query(nullptr, &video_param);
340340
if (sts == MFX_ERR_NONE) {
341341
// Consider removing this from supported list?
342342
VideoDecoderCapability vp8_cap;
@@ -354,59 +354,59 @@ MediaCapabilities::SupportedCapabilitiesForVideoDecoder(
354354
}
355355

356356
MediaCapabilities* MediaCapabilities::Get() {
357-
std::lock_guard<std::mutex> lock(get_singleton_mutex);
357+
std::lock_guard<std::mutex> lock(get_singleton_mutex_);
358358

359-
if (singleton == nullptr) {
360-
singleton = new MediaCapabilities();
359+
if (singleton_ == nullptr) {
360+
singleton_ = new MediaCapabilities();
361361

362-
if (singleton && !singleton->Init()) {
363-
delete singleton;
364-
singleton = nullptr;
362+
if (singleton_ && !singleton_->Init()) {
363+
delete singleton_;
364+
singleton_ = nullptr;
365365
}
366366
}
367367

368-
return singleton;
368+
return singleton_;
369369
}
370370

371371
MediaCapabilities::MediaCapabilities() {}
372372

373373
MediaCapabilities::~MediaCapabilities() {
374-
if (mfx_encoder) {
375-
mfx_encoder->Close();
376-
mfx_encoder.reset();
374+
if (mfx_encoder_) {
375+
mfx_encoder_->Close();
376+
mfx_encoder_.reset();
377377
}
378-
if (mfx_decoder) {
379-
mfx_decoder->Close();
380-
mfx_decoder.reset();
378+
if (mfx_decoder_) {
379+
mfx_decoder_->Close();
380+
mfx_decoder_.reset();
381381
}
382-
if (msdk_factory && mfx_session) {
383-
msdk_factory->DestroySession(mfx_session);
382+
if (msdk_factory_ && mfx_session_) {
383+
msdk_factory_->DestroySession(mfx_session_);
384384
}
385385
}
386386

387387
bool MediaCapabilities::Init() {
388388
bool res = false;
389-
msdk_factory = owt::base::MSDKFactory::Get();
390-
if (!msdk_factory)
389+
msdk_factory_ = owt::base::MSDKFactory::Get();
390+
if (!msdk_factory_)
391391
goto failed;
392392

393-
mfx_session = msdk_factory->CreateSession();
394-
if (!mfx_session)
393+
mfx_session_ = msdk_factory_->CreateSession();
394+
if (!mfx_session_)
395395
goto failed;
396396

397397
// Create the underlying MFXVideoDECODE and MFXVideoENCODE
398398
// instances.
399-
mfx_encoder.reset(new MFXVideoENCODE(*mfx_session));
400-
if (!mfx_encoder)
399+
mfx_encoder_.reset(new MFXVideoENCODE(*mfx_session_));
400+
if (!mfx_encoder_)
401401
goto failed;
402402

403-
mfx_decoder.reset(new MFXVideoDECODE(*mfx_session));
404-
if (!mfx_decoder)
403+
mfx_decoder_.reset(new MFXVideoDECODE(*mfx_session_));
404+
if (!mfx_decoder_)
405405
goto failed;
406406

407-
res = msdk_factory->QueryPlatform(mfx_session, &mfx_platform);
407+
res = msdk_factory_->QueryPlatform(mfx_session_, &mfx_platform_);
408408
if (res)
409-
inited = true;
409+
inited_ = true;
410410

411411
failed:
412412
return res;

talk/owt/sdk/base/win/mediacapabilities.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ class MediaCapabilities {
5959
~MediaCapabilities();
6060
std::vector<VideoEncoderCapability> SupportedCapabilitiesForVideoEncoder(
6161
std::vector<owt::base::VideoCodec>& codec_types);
62-
std::vector<VideoDecoderCapability> SupportedCapabilitiesForVideoDecoder(std::vector<owt::base::VideoCodec>& codec_types);
62+
std::vector<VideoDecoderCapability> SupportedCapabilitiesForVideoDecoder(std::vector<owt::base::VideoCodec>& codec_types);
6363
static MediaCapabilities* Get();
6464
private:
6565
bool Init();
6666
MediaCapabilities();
67-
static MediaCapabilities* singleton;
68-
static std::mutex get_singleton_mutex;
67+
static MediaCapabilities* singleton_;
68+
static std::mutex get_singleton_mutex_;
6969
#ifdef OWT_USE_MSDK
70-
MFXVideoSession* mfx_session;
71-
std::unique_ptr<MFXVideoENCODE> mfx_encoder;
72-
std::unique_ptr<MFXVideoDECODE> mfx_decoder;
73-
mfxPlatform mfx_platform;
74-
owt::base::MSDKFactory* msdk_factory;
70+
MFXVideoSession* mfx_session_;
71+
std::unique_ptr<MFXVideoENCODE> mfx_encoder_;
72+
std::unique_ptr<MFXVideoDECODE> mfx_decoder_;
73+
mfxPlatform mfx_platform_;
74+
owt::base::MSDKFactory* msdk_factory_;
7575
#endif
76-
bool inited = false;
76+
bool inited_ = false;
7777
};
7878
} // namespace base
7979
} // namespace owt

0 commit comments

Comments
 (0)