2018-08-28 00:54:42 +00:00
|
|
|
// Copyright 2018 Google LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
#include "packager/media/codecs/av1_parser.h"
|
|
|
|
|
2018-10-09 17:41:18 +00:00
|
|
|
#include <gmock/gmock.h>
|
2018-08-28 00:54:42 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "packager/media/test/test_data_util.h"
|
|
|
|
|
2018-10-09 17:41:18 +00:00
|
|
|
using ::testing::ElementsAre;
|
|
|
|
|
2018-08-28 00:54:42 +00:00
|
|
|
namespace shaka {
|
|
|
|
namespace media {
|
|
|
|
|
2018-10-09 17:41:18 +00:00
|
|
|
inline bool operator==(const AV1Parser::Tile& lhs, const AV1Parser::Tile& rhs) {
|
|
|
|
return lhs.start_offset_in_bytes == rhs.start_offset_in_bytes &&
|
|
|
|
lhs.size_in_bytes == rhs.size_in_bytes;
|
|
|
|
}
|
|
|
|
|
2018-08-28 00:54:42 +00:00
|
|
|
TEST(AV1ParserTest, ParseIFrameSuccess) {
|
|
|
|
const std::vector<uint8_t> buffer = ReadTestDataFile("av1-I-frame-320x240");
|
2023-07-17 20:16:22 +00:00
|
|
|
ASSERT_FALSE(buffer.empty());
|
2018-08-28 00:54:42 +00:00
|
|
|
|
|
|
|
AV1Parser parser;
|
2018-10-09 17:41:18 +00:00
|
|
|
std::vector<AV1Parser::Tile> tiles;
|
|
|
|
ASSERT_TRUE(parser.Parse(buffer.data(), buffer.size(), &tiles));
|
|
|
|
EXPECT_THAT(tiles, ElementsAre(AV1Parser::Tile{0x1d, 0x4e1}));
|
2018-08-28 00:54:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace media
|
|
|
|
} // namespace shaka
|