Skip to content

Commit

Permalink
Reland of Modify profiles for H264 encode SW fallback (patchset #1 id…
Browse files Browse the repository at this point in the history
…:1 of https://codereview.webrtc.org/2995373002/ )

Reason for revert:
Fix and reland.

Original issue's description:
> Revert of Modify profiles for H264 encode SW fallback (patchset webrtc-uwp#2 id:20001 of https://codereview.webrtc.org/2997913003/ )
>
> Reason for revert:
> Breaks the internal bots.
> Root cause: The "public_deps" is defined behind an "if" condition which may not be true.
>
> Original issue's description:
> > Modify profiles for H264 encode SW fallback
> >
> > We have only Constrained Baseline profile available in SW encoder impl
> > so modify the profile to that in case  of a fallback
> >
> > BUG=chromium:735959
> >
> > Review-Url: https://codereview.webrtc.org/2997913003
> > Cr-Commit-Position: refs/heads/master@{#19436}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/1fd66656b3754c22a43f4eded57e022916bb6064
>
> [email protected],[email protected]
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=chromium:735959
>
> Review-Url: https://codereview.webrtc.org/2995373002
> Cr-Commit-Position: refs/heads/master@{#19438}
> Committed: https://chromium.googlesource.com/external/webrtc/+/296b64eb25949d84d9cb85fce02e7ba05be9d419

[email protected],[email protected]
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=chromium:735959

Review-Url: https://codereview.webrtc.org/2997423002
Cr-Commit-Position: refs/heads/master@{#19476}
  • Loading branch information
uysalere authored and Commit Bot committed Aug 23, 2017
1 parent d4ab933 commit 82fac89
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions webrtc/media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ rtc_static_library("rtc_media_base") {
defines = []
libs = []
deps = []
public_deps = []
sources = [
"base/adaptedvideotracksource.cc",
"base/adaptedvideotracksource.h",
Expand Down Expand Up @@ -108,23 +109,22 @@ rtc_static_library("rtc_media_base") {
include_dirs = []
if (rtc_build_libyuv) {
deps += [ "$rtc_libyuv_dir" ]
public_deps = [
"$rtc_libyuv_dir",
]
public_deps += [ "$rtc_libyuv_dir" ]
} else {
# Need to add a directory normally exported by libyuv.
include_dirs += [ "$rtc_libyuv_dir/include" ]
}

deps += [
":rtc_h264_profile_id",
"..:webrtc_common",
"../api:libjingle_peerconnection_api",
"../p2p",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
]

public_deps += [ ":rtc_h264_profile_id" ]

if (is_nacl) {
deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
}
Expand Down
11 changes: 11 additions & 0 deletions webrtc/media/engine/videoencodersoftwarefallbackwrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h"

#include "webrtc/media/base/h264_profile_level_id.h"
#include "webrtc/media/engine/internalencoderfactory.h"
#include "webrtc/modules/video_coding/include/video_error_codes.h"
#include "webrtc/rtc_base/checks.h"
Expand Down Expand Up @@ -89,6 +90,7 @@ VideoEncoderSoftwareFallbackWrapper::VideoEncoderSoftwareFallbackWrapper(
}

bool VideoEncoderSoftwareFallbackWrapper::InitFallbackEncoder() {
MaybeModifyCodecForFallback();
cricket::InternalEncoderFactory internal_factory;
if (!FindMatchingCodec(internal_factory.supported_codecs(), codec_)) {
LOG(LS_WARNING)
Expand Down Expand Up @@ -355,4 +357,13 @@ bool VideoEncoderSoftwareFallbackWrapper::ForcedFallbackParams::ShouldStop(
(codec.width * codec.height >= kMinPixelsStop);
}

void VideoEncoderSoftwareFallbackWrapper::MaybeModifyCodecForFallback() {
// We have a specific case for H264 ConstrainedBaseline because that is the
// only supported profile in Sw fallback.
if (!cricket::CodecNamesEq(codec_.name.c_str(), cricket::kH264CodecName))
return;
codec_.SetParam(cricket::kH264FmtpProfileLevelId,
cricket::kH264ProfileLevelConstrainedBaseline);
}

} // namespace webrtc
3 changes: 2 additions & 1 deletion webrtc/media/engine/videoencodersoftwarefallbackwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder {
bool TryReInitForcedFallbackEncoder();
void ValidateSettingsForForcedFallback();
bool IsForcedFallbackActive() const;
void MaybeModifyCodecForFallback();

// Settings used in the last InitEncode call and used if a dynamic fallback to
// software is required.
Expand All @@ -94,7 +95,7 @@ class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder {
uint32_t packet_loss_;
int64_t rtt_;

const cricket::VideoCodec codec_;
cricket::VideoCodec codec_;
webrtc::VideoEncoder* const encoder_;

std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
Expand Down

0 comments on commit 82fac89

Please sign in to comment.