-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audio: Add AC3/EAC3 support in EME on Windows platform (#4744)
For AC3/EAC3 stream protected under DRM, we need to parse dac3 and dec3 box infomation in encryption box. And if CDM support AC3/EAC3 codec, we also need to convert AC3/EAC3 AudioCodec to EME_CODEC. This change is backported from m120+. (cherry picked from commit 866e79517d2d4fb1aeccc7162c6c90833ed96bb2) Bug: 388666932 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4489383
- Loading branch information
Showing
7 changed files
with
178 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <stdint.h> | ||
|
||
#include "media/base/mock_media_log.h" | ||
#include "media/formats/mp4/ac3.h" | ||
#include "testing/gmock/include/gmock/gmock.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
using ::testing::AllOf; | ||
using ::testing::HasSubstr; | ||
using ::testing::InSequence; | ||
using ::testing::StrictMock; | ||
|
||
namespace media { | ||
|
||
namespace mp4 { | ||
|
||
class AC3Test : public testing::Test { | ||
public: | ||
AC3Test() = default; | ||
|
||
bool Parse(const std::vector<uint8_t>& data) { | ||
return ac3_.Parse(data, &media_log_); | ||
} | ||
|
||
StrictMock<MockMediaLog> media_log_; | ||
AC3 ac3_; | ||
}; | ||
|
||
TEST_F(AC3Test, NoInputTest) { | ||
std::vector<uint8_t> data; | ||
EXPECT_FALSE(Parse(data)); | ||
} | ||
|
||
TEST_F(AC3Test, ShortInvalidInputTest) { | ||
std::vector<uint8_t> data({0x50, 0x11}); | ||
|
||
EXPECT_FALSE(Parse(data)); | ||
} | ||
|
||
TEST_F(AC3Test, NormalInputTest) { | ||
std::vector<uint8_t> data({0x50, 0x11, 0x40}); | ||
|
||
EXPECT_TRUE(Parse(data)); | ||
EXPECT_EQ(ac3_.GetChannelCount(), 2u); | ||
} | ||
|
||
} // namespace mp4 | ||
|
||
} // namespace media |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <stdint.h> | ||
|
||
#include "media/base/mock_media_log.h" | ||
#include "media/formats/mp4/eac3.h" | ||
#include "testing/gmock/include/gmock/gmock.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
using ::testing::AllOf; | ||
using ::testing::HasSubstr; | ||
using ::testing::InSequence; | ||
using ::testing::StrictMock; | ||
|
||
namespace media { | ||
|
||
namespace mp4 { | ||
|
||
class EAC3Test : public testing::Test { | ||
public: | ||
EAC3Test() = default; | ||
|
||
bool Parse(const std::vector<uint8_t>& data) { | ||
return eac3_.Parse(data, &media_log_); | ||
} | ||
|
||
StrictMock<MockMediaLog> media_log_; | ||
EAC3 eac3_; | ||
}; | ||
|
||
TEST_F(EAC3Test, NoInputTest) { | ||
std::vector<uint8_t> data; | ||
EXPECT_FALSE(Parse(data)); | ||
} | ||
|
||
TEST_F(EAC3Test, ShortInvalidInputTest) { | ||
std::vector<uint8_t> data({0x06, 0xC8}); | ||
|
||
EXPECT_FALSE(Parse(data)); | ||
} | ||
|
||
TEST_F(EAC3Test, NormalInputTest) { | ||
std::vector<uint8_t> data({0x06, 0xC8, 0x60, 0x04, 0x00}); | ||
|
||
EXPECT_TRUE(Parse(data)); | ||
EXPECT_EQ(eac3_.GetChannelCount(), 2u); | ||
} | ||
|
||
} // namespace mp4 | ||
|
||
} // namespace media |