mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-03 09:48:38 +02:00
Prefer timestamp from the OpenH264 decoder if available. This patch bumps the API version for the GMP plugin API. The OpenH264 library takes advatange of this. It also adds a few quality of life options. One request the GMP library logging be turned on via the "GMPLibrary" log module. One can toggle between single and multi-threaded decoding via media.gmp.decoder.multithreaded. One can toggle between single or batch decoding via media.gmp.decoder.decode_batch. Provided the OpenH264 library supports this, it will now provide the adjusted presentation timestamp from the decoder. This is necessary for encodings with B frames that may be out of order. This corresponds to the SBufferInfo::uiOutYuvTimestamp from the library. If it is not available, we will default to our historical behaviour and use the original presentation timestamp. Additionally, we now assume that H264 frames may also be provided out of order, and we provide a reorder queue to buffer the input similar to the other H264 decoders such as Apple's and Widevine's. This will ensure that regardless of the plugin output, we will provide any necessary reordering. Differential Revision: https://phabricator.services.mozilla.com/D175281
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef DOM_MEDIA_GMPLOG_H_
|
|
#define DOM_MEDIA_GMPLOG_H_
|
|
|
|
#include "content_decryption_module.h"
|
|
#include "gmp-video-codec.h"
|
|
#include "mozilla/Logging.h"
|
|
|
|
namespace mozilla {
|
|
|
|
extern LogModule* GetGMPLog();
|
|
extern LogModule* GetGMPLibraryLog();
|
|
extern GMPLogLevel GetGMPLibraryLogLevel();
|
|
|
|
#define GMP_LOG_ERROR(msg, ...) \
|
|
MOZ_LOG(GetGMPLog(), LogLevel::Error, (msg, ##__VA_ARGS__))
|
|
#define GMP_LOG_WARNING(msg, ...) \
|
|
MOZ_LOG(GetGMPLog(), LogLevel::Warning, (msg, ##__VA_ARGS__))
|
|
#define GMP_LOG_INFO(msg, ...) \
|
|
MOZ_LOG(GetGMPLog(), LogLevel::Info, (msg, ##__VA_ARGS__))
|
|
#define GMP_LOG_DEBUG(msg, ...) \
|
|
MOZ_LOG(GetGMPLog(), LogLevel::Debug, (msg, ##__VA_ARGS__))
|
|
#define GMP_LOG_VERBOSE(msg, ...) \
|
|
MOZ_LOG(GetGMPLog(), LogLevel::Verbose, (msg, ##__VA_ARGS__))
|
|
|
|
// Helpers
|
|
|
|
inline const char* CdmStatusToString(cdm::Status aStatus) {
|
|
switch (aStatus) {
|
|
case cdm::Status::kSuccess:
|
|
return "success";
|
|
case cdm::Status::kNeedMoreData:
|
|
return "need more data";
|
|
case cdm::Status::kNoKey:
|
|
return "no key";
|
|
case cdm::Status::kInitializationError:
|
|
return "initialization error";
|
|
case cdm::Status::kDecryptError:
|
|
return "decrypt error";
|
|
case cdm::Status::kDecodeError:
|
|
return "decode error";
|
|
case cdm::Status::kDeferredInitialization:
|
|
return "deferred initialization";
|
|
default:
|
|
MOZ_ASSERT_UNREACHABLE("Should have coverage of entire enum");
|
|
return "unexpected status code"; // Gracefully handle disabled asserts.
|
|
}
|
|
}
|
|
|
|
inline const char* CdmStatusToString(uint32_t aStatus) {
|
|
return CdmStatusToString(cdm::Status(aStatus));
|
|
}
|
|
|
|
// End helpers
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // DOM_MEDIA_GMPLOG_H_
|