Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m97_release #26

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/rtc_mediaconstraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class RTCMediaConstraints : public RefCountInterface {
LIB_WEBRTC_API static const char* kValueFalse; // false

// PeerConnection constraint keys.
// Temporary pseudo-constraints used to enable DTLS-SRTP
LIB_WEBRTC_API static const char* kEnableDtlsSrtp; // Enable DTLS-SRTP
// Temporary pseudo-constraints used to enable DataChannels
LIB_WEBRTC_API static const char*
kEnableRtpDataChannels; // Enable RTP DataChannels
Expand Down
2 changes: 0 additions & 2 deletions src/rtc_mediaconstraints_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const char* RTCMediaConstraints::kValueTrue =
webrtc::MediaConstraints::kValueTrue;
const char* RTCMediaConstraints::kValueFalse =
webrtc::MediaConstraints::kValueFalse;
const char* RTCMediaConstraints::kEnableDtlsSrtp =
webrtc::MediaConstraints::kEnableDtlsSrtp;
const char* RTCMediaConstraints::kEnableDscp =
webrtc::MediaConstraints::kEnableDscp;
const char* RTCMediaConstraints::kEnableIPv6 =
Expand Down
13 changes: 10 additions & 3 deletions src/rtc_peerconnection_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,18 @@ scoped_refptr<RTCDataChannel> RTCPeerConnectionImpl::CreateDataChannel(
init.protocol = to_std_string(dataChannelDict->protocol);
init.reliable = dataChannelDict->reliable;

rtc::scoped_refptr<webrtc::DataChannelInterface> rtc_data_channel =
rtc_peerconnection_->CreateDataChannel(to_std_string(label), &init);
webrtc::RTCErrorOr<rtc::scoped_refptr<webrtc::DataChannelInterface>> result =
rtc_peerconnection_->CreateDataChannelOrError(to_std_string(label), &init);

if (!result.ok()) {
RTC_LOG(LS_ERROR) << "CreateDataChannel failed: "
<< ToString(result.error().type()) << " "
<< result.error().message();
return nullptr;
}

data_channel_ = scoped_refptr<RTCDataChannelImpl>(
new RefCountedObject<RTCDataChannelImpl>(rtc_data_channel));
new RefCountedObject<RTCDataChannelImpl>(result.MoveValue()));

dataChannelDict->id = init.id;
return data_channel_;
Expand Down
4 changes: 0 additions & 4 deletions src/rtc_video_frame_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,12 @@ libwebrtc::RTCVideoFrame::VideoRotation VideoFrameBufferImpl::rotation() {
switch (rotation_) {
case webrtc::kVideoRotation_0:
return RTCVideoFrame::kVideoRotation_0;
break;
case webrtc::kVideoRotation_90:
return RTCVideoFrame::kVideoRotation_90;
break;
case webrtc::kVideoRotation_180:
return RTCVideoFrame::kVideoRotation_180;
break;
case webrtc::kVideoRotation_270:
return RTCVideoFrame::kVideoRotation_270;
break;
default:
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/win/base_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ mfxStatus BaseFrameAllocator::FreeFrames(mfxFrameAllocResponse *response)

// check whether response is an external decoder response
std::list<UniqueResponse>::iterator i =
std::find_if( m_ExtResponses.begin(), m_ExtResponses.end(), std::bind1st(IsSame(), *response));
std::find_if( m_ExtResponses.begin(), m_ExtResponses.end(), std::bind(IsSame(), std::placeholders::_1, *response));

if (i != m_ExtResponses.end())
{
Expand All @@ -208,7 +208,7 @@ mfxStatus BaseFrameAllocator::FreeFrames(mfxFrameAllocResponse *response)

// if not found so far, then search in internal responses
std::list<mfxFrameAllocResponse>::iterator i2 =
std::find_if(m_responses.begin(), m_responses.end(), std::bind1st(IsSame(), *response));
std::find_if(m_responses.begin(), m_responses.end(), std::bind(IsSame(), std::placeholders::_1, *response));

if (i2 != m_responses.end())
{
Expand Down
15 changes: 8 additions & 7 deletions src/win/codecutils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
#include "absl/types/optional.h"
#include "media/base/media_constants.h"
#include "src/win/codecutils.h"
#include "api/video_codecs/h264_profile_level_id.h"

namespace owt {
namespace base {

webrtc::SdpVideoFormat CreateH264Format(webrtc::H264::Profile profile,
webrtc::H264::Level level,
webrtc::SdpVideoFormat CreateH264Format(webrtc::H264Profile profile,
webrtc::H264Level level,
const std::string& packetization_mode) {
const absl::optional<std::string> profile_string =
webrtc::H264::ProfileLevelIdToString(webrtc::H264::ProfileLevelId(profile, level));
webrtc::H264ProfileLevelIdToString(webrtc::H264ProfileLevelId(profile, level));
return webrtc::SdpVideoFormat(
cricket::kH264CodecName,
{{cricket::kH264FmtpProfileLevelId, *profile_string},
Expand All @@ -25,10 +26,10 @@ webrtc::SdpVideoFormat CreateH264Format(webrtc::H264::Profile profile,

std::vector<webrtc::SdpVideoFormat> CodecUtils::SupportedH264Codecs() {
return {
CreateH264Format(webrtc::H264::kProfileBaseline, webrtc::H264::kLevel3_1, "1"),
CreateH264Format(webrtc::H264::kProfileBaseline, webrtc::H264::kLevel3_1, "0"),
CreateH264Format(webrtc::H264::kProfileConstrainedBaseline, webrtc::H264::kLevel3_1, "1"),
CreateH264Format(webrtc::H264::kProfileConstrainedBaseline, webrtc::H264::kLevel3_1,
CreateH264Format(webrtc::H264Profile::kProfileBaseline, webrtc::H264Level::kLevel3_1, "1"),
CreateH264Format(webrtc::H264Profile::kProfileBaseline, webrtc::H264Level::kLevel3_1, "0"),
CreateH264Format(webrtc::H264Profile::kProfileConstrainedBaseline, webrtc::H264Level::kLevel3_1, "1"),
CreateH264Format(webrtc::H264Profile::kProfileConstrainedBaseline, webrtc::H264Level::kLevel3_1,
"0")};
}

Expand Down
2 changes: 1 addition & 1 deletion src/win/codecutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <vector>
#include "api/video_codecs/sdp_video_format.h"
#include "api/video/video_codec_type.h"
#include "media/base/h264_profile_level_id.h"

namespace owt {
namespace base {
class CodecUtils {
Expand Down
2 changes: 1 addition & 1 deletion src/win/mediautils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ absl::optional<AV1Profile> StringToAV1Profile(const std::string& str) {
case 2:
return AV1Profile::kProfessional;
default:
return absl::nullopt;
break;
}
return absl::nullopt;
}
Expand Down
26 changes: 11 additions & 15 deletions src/win/msdkvideodecoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,21 @@ bool MSDKVideoDecoder::CreateD3D11Device() {
return true;
}

int32_t MSDKVideoDecoder::InitDecode(const webrtc::VideoCodec* codecSettings, int32_t numberOfCores) {
bool MSDKVideoDecoder::Configure(const Settings& settings) {

RTC_LOG(LS_INFO) << "InitDecode enter";
if (!codecSettings){
RTC_LOG(LS_ERROR) << "Invalid codec settings passed to decoder";
return WEBRTC_VIDEO_CODEC_ERROR;
}
codec_type_ = codecSettings->codecType;

codec_type_ = settings.codec_type();
timestamps_.clear();
ntp_time_ms_.clear();

if (&codec_ != codecSettings)
codec_ = *codecSettings;
settings_ = settings;

//return decoder_thread_->Invoke<int32_t>(RTC_FROM_HERE,
// Bind(&MSDKVideoDecoder::InitDecodeOnCodecThread, this));
return decoder_thread_->Invoke<int32_t>(
return decoder_thread_->Invoke<bool>(
RTC_FROM_HERE, [this] {
return InitDecodeOnCodecThread();
return InitDecodeOnCodecThread() == WEBRTC_VIDEO_CODEC_OK;
});
}

Expand All @@ -186,8 +182,8 @@ int32_t MSDKVideoDecoder::InitDecodeOnCodecThread() {
m_video_param_extracted = false;

mfxStatus sts;
width_ = codec_.width;
height_ = codec_.height;
width_ = settings_.max_render_resolution().Width();
height_ = settings_.max_render_resolution().Height();
uint32_t codec_id = MFX_CODEC_AVC;

if (inited_) {
Expand All @@ -204,11 +200,11 @@ int32_t MSDKVideoDecoder::InitDecodeOnCodecThread() {
if (!m_mfx_session_) {
return WEBRTC_VIDEO_CODEC_ERROR;
}
if (codec_.codecType == webrtc::kVideoCodecVP8) {
if (settings_.codec_type() == webrtc::kVideoCodecVP8) {
codec_id = MFX_CODEC_VP8;
} else if (codec_.codecType == webrtc::kVideoCodecVP9) {
} else if (settings_.codec_type() == webrtc::kVideoCodecVP9) {
codec_id = MFX_CODEC_VP9;
} else if (codec_.codecType == webrtc::kVideoCodecAV1) {
} else if (settings_.codec_type() == webrtc::kVideoCodecAV1) {
codec_id = MFX_CODEC_AV1;
}

Expand Down
5 changes: 2 additions & 3 deletions src/win/msdkvideodecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ class MSDKVideoDecoder : public webrtc::VideoDecoder {

static std::unique_ptr<MSDKVideoDecoder> Create(cricket::VideoCodec format);

int32_t InitDecode(const webrtc::VideoCodec* codecSettings, int32_t numberOfCores)
override;
bool Configure(const Settings& settings) override;

int32_t Decode(
const webrtc::EncodedImage& inputImage, bool missingFrames,
Expand Down Expand Up @@ -109,7 +108,7 @@ class MSDKVideoDecoder : public webrtc::VideoDecoder {
int height_;
std::unique_ptr<rtc::Thread> decoder_thread_; // Thread on which the decoder will be working on.

webrtc::VideoCodec codec_;
webrtc::VideoDecoder::Settings settings_;
webrtc::DecodedImageCallback* callback_;
webrtc::Mutex timestampCS_;
std::vector<int64_t> ntp_time_ms_;
Expand Down
2 changes: 1 addition & 1 deletion src/win/msdkvideoencoderfactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "src/win/codecutils.h"
#include "src/win/msdkvideoencoder.h"
//#include "common_video/h264/profile_level_id.h"
#include "media/base/vp9_profile.h"
//#include "media/base/vp9_profile.h"

namespace owt {
namespace base {
Expand Down