mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00: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
Notes:
github-actions[bot]
2025-09-22 17:05:47 +00:00
Author: https://github.com/Zaggy1024
Commit: 6cbe607ecf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6240
Reviewed-by: https://github.com/gmta ✅
5 changed files with 9 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue