Skip to content

Commit

Permalink
[Code Health] Clean up some pre-Nougat code in media/ code
Browse files Browse the repository at this point in the history
Marshmallow is deprecated in chrome, this code is not needed anymore

Change-Id: I6f5751f6ef3edb30ac55ce0779c9cdd6a396d23b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3929886
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Matthew Wolenetz <wolenetz@chromium.org>
Commit-Queue: jagdish samsung <jagdish.c@samsung.com>
Cr-Commit-Position: refs/heads/main@{#1053888}
  • Loading branch information
Jagdish Chourasia authored and Chromium LUCI CQ committed Oct 1, 2022
1 parent 9e6259a commit a6752ba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 33 deletions.
4 changes: 2 additions & 2 deletions media/base/android/media_codec_loop_unittest.cc
Expand Up @@ -91,7 +91,7 @@ class MediaCodecLoopTest : public testing::Test {
}

void ConstructCodecLoop() {
int sdk_int = base::android::SDK_VERSION_MARSHMALLOW;
int sdk_int = base::android::SDK_VERSION_NOUGAT;
auto codec = std::make_unique<MockMediaCodecBridge>();
// Since we're providing a codec, we do not expect an error.
EXPECT_CALL(*client_, OnCodecLoopError()).Times(0);
Expand Down Expand Up @@ -199,7 +199,7 @@ class MediaCodecLoopTest : public testing::Test {
TEST_F(MediaCodecLoopTest, TestConstructionWithNullCodec) {
std::unique_ptr<MediaCodecBridge> codec;
EXPECT_CALL(*client_, OnCodecLoopError()).Times(1);
const int sdk_int = base::android::SDK_VERSION_MARSHMALLOW;
const int sdk_int = base::android::SDK_VERSION_NOUGAT;
codec_loop_ = std::make_unique<MediaCodecLoop>(
sdk_int, client_.get(), std::move(codec),
scoped_refptr<base::SingleThreadTaskRunner>());
Expand Down
3 changes: 0 additions & 3 deletions media/base/android/media_codec_util_unittest.cc
Expand Up @@ -9,7 +9,6 @@
namespace media {

// These will come from mockable BuildInfo, once it exists.
using base::android::SDK_VERSION_MARSHMALLOW;
using base::android::SDK_VERSION_NOUGAT;
using base::android::SDK_VERSION_NOUGAT_MR1;

Expand All @@ -26,8 +25,6 @@ class MediaCodecUtilTest : public testing::Test {
};

TEST_F(MediaCodecUtilTest, TestCbcsAvailableIfNewerVersion) {
EXPECT_FALSE(
MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_MARSHMALLOW));
EXPECT_FALSE(
MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_NOUGAT));
EXPECT_TRUE(
Expand Down
31 changes: 10 additions & 21 deletions media/base/android/media_drm_bridge_unittest.cc
Expand Up @@ -23,14 +23,14 @@ using ::testing::StrictMock;

namespace media {

#define EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(a) \
do { \
if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { \
VLOG(0) << "Widevine not supported on device."; \
EXPECT_FALSE(a); \
} else { \
EXPECT_TRUE(a); \
} \
#define EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(a) \
do { \
if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { \
VLOG(0) << "Widevine not supported on device."; \
EXPECT_FALSE(a); \
} else { \
EXPECT_TRUE(a); \
} \
} while (0)

const char kAudioMp4[] = "audio/mp4";
Expand Down Expand Up @@ -128,11 +128,10 @@ TEST_F(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) {
EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(
IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4));


EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(
IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM));
IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM));
EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(
IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM));
IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM));

EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "unknown"));
EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "video/avi"));
Expand Down Expand Up @@ -186,16 +185,6 @@ TEST_F(MediaDrmBridgeTest, Provision_Widevine) {
return;
}

// On Android M occasionally MediaDrm.getProvisionRequest() throws and thus a
// request can not be generated. This has been fixed in Android N. As Android
// M is unlikely to be fixed, disabling this test if running on Android M.
// http://crbug.com/973096#c21
if (base::android::BuildInfo::GetInstance()->sdk_int() ==
base::android::SDK_VERSION_MARSHMALLOW) {
VLOG(0) << "Disabled for Android M.";
return;
}

// Calling Provision() later should trigger a provisioning request. As we
// can't pass the request to a license server,
// MockProvisionFetcher::Retrieve() simply drops the request and never
Expand Down
10 changes: 3 additions & 7 deletions media/filters/android/media_codec_audio_decoder.cc
Expand Up @@ -173,13 +173,9 @@ bool MediaCodecAudioDecoder::CreateMediaCodecLoop() {
std::unique_ptr<MediaCodecBridge> audio_codec_bridge(
MediaCodecBridgeImpl::CreateAudioDecoder(
config_, media_crypto,
// Use the asynchronous API if we're on Marshallow or higher.
base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_MARSHMALLOW
? BindToCurrentLoop(base::BindRepeating(
&MediaCodecAudioDecoder::PumpMediaCodecLoop,
weak_factory_.GetWeakPtr()))
: base::RepeatingClosure()));
BindToCurrentLoop(
base::BindRepeating(&MediaCodecAudioDecoder::PumpMediaCodecLoop,
weak_factory_.GetWeakPtr()))));
if (!audio_codec_bridge) {
DLOG(ERROR) << __func__ << " failed: cannot create MediaCodecBridge";
return false;
Expand Down

0 comments on commit a6752ba

Please sign in to comment.