summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2023-02-13 17:07:12 -0600
committerJelle Raaijmakers <jelle@gmta.nl>2023-04-23 23:14:30 +0200
commita8604d93566820bd9bc96c7ee7d5072e66261121 (patch)
treebf83fc0d3f052f73adff47306b8ecfbf1c420196
parent8ce4245214d6a2e259e463acb9b8b958af58c99e (diff)
downloadserenity-a8604d93566820bd9bc96c7ee7d5072e66261121.zip
LibVideo/VP9: Fallibly allocate the probability tables
-rw-r--r--Userland/Libraries/LibVideo/VP9/Parser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp
index 80c325d91e..4d2ef95e54 100644
--- a/Userland/Libraries/LibVideo/VP9/Parser.cpp
+++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp
@@ -23,8 +23,7 @@ namespace Video::VP9 {
#define TRY_READ(expression) DECODER_TRY(DecoderErrorCategory::Corrupted, expression)
Parser::Parser(Decoder& decoder)
- : m_probability_tables(make<ProbabilityTables>())
- , m_decoder(decoder)
+ : m_decoder(decoder)
{
}
@@ -82,6 +81,8 @@ Vector<size_t> Parser::parse_superframe_sizes(ReadonlyBytes frame_data)
/* (6.1) */
DecoderErrorOr<FrameContext> Parser::parse_frame(ReadonlyBytes frame_data)
{
+ if (!m_probability_tables)
+ m_probability_tables = DECODER_TRY_ALLOC(try_make<ProbabilityTables>());
m_syntax_element_counter = make<SyntaxElementCounter>();
// NOTE: m_reusable_frame_block_contexts does not need to retain any data between frame decodes.