mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibMedia+Tests: Call decoder input samples "coded data" for clarity
The word sample is very ambiguous in the realm of decoders, so let's just make it abundantly clear what the decoder is receiving.
This commit is contained in:
parent
8d77e8b09d
commit
6cbe607ecf
|
|
@ -104,12 +104,12 @@ FFmpegVideoDecoder::~FFmpegVideoDecoder()
|
|||
avcodec_free_context(&m_codec_context);
|
||||
}
|
||||
|
||||
DecoderErrorOr<void> FFmpegVideoDecoder::receive_sample(AK::Duration timestamp, ReadonlyBytes sample)
|
||||
DecoderErrorOr<void> FFmpegVideoDecoder::receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data)
|
||||
{
|
||||
VERIFY(sample.size() < NumericLimits<int>::max());
|
||||
VERIFY(coded_data.size() < NumericLimits<int>::max());
|
||||
|
||||
m_packet->data = const_cast<u8*>(sample.data());
|
||||
m_packet->size = static_cast<int>(sample.size());
|
||||
m_packet->data = const_cast<u8*>(coded_data.data());
|
||||
m_packet->size = static_cast<int>(coded_data.size());
|
||||
m_packet->pts = timestamp.to_microseconds();
|
||||
m_packet->dts = m_packet->pts;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public:
|
|||
FFmpegVideoDecoder(AVCodecContext* codec_context, AVPacket* packet, AVFrame* frame);
|
||||
~FFmpegVideoDecoder();
|
||||
|
||||
DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ReadonlyBytes sample) override;
|
||||
DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data) override;
|
||||
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() override;
|
||||
|
||||
void flush() override;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void PlaybackManager::decode_and_queue_one_sample()
|
|||
container_cicp = sample.auxiliary_data().get<CodedVideoFrameData>().container_cicp();
|
||||
|
||||
// Submit the sample to the decoder.
|
||||
auto decode_result = m_decoder->receive_sample(sample.timestamp(), sample.data());
|
||||
auto decode_result = m_decoder->receive_coded_data(sample.timestamp(), sample.data());
|
||||
if (decode_result.is_error()) {
|
||||
item_to_enqueue = FrameQueueItem::error_marker(decode_result.release_error(), sample.timestamp());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ class VideoDecoder {
|
|||
public:
|
||||
virtual ~VideoDecoder() { }
|
||||
|
||||
virtual DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ReadonlyBytes sample) = 0;
|
||||
DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ByteBuffer const& sample) { return receive_sample(timestamp, sample.span()); }
|
||||
virtual DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data) = 0;
|
||||
DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ByteBuffer const& coded_data) { return receive_coded_data(timestamp, coded_data.span()); }
|
||||
virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
|
||||
|
||||
virtual void flush() = 0;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ static inline void decode_video(StringView path, size_t expected_frame_count, T
|
|||
|
||||
auto block = block_result.release_value();
|
||||
for (auto const& frame : block.frames()) {
|
||||
MUST(decoder->receive_sample(block.timestamp(), frame));
|
||||
MUST(decoder->receive_coded_data(block.timestamp(), frame));
|
||||
while (true) {
|
||||
auto frame_result = decoder->get_decoded_frame();
|
||||
if (frame_result.is_error()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user