Skip to content

Commit 6cbe607

Browse files
committed
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.
1 parent 8d77e8b commit 6cbe607

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Libraries/LibMedia/FFmpeg/FFmpegVideoDecoder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ FFmpegVideoDecoder::~FFmpegVideoDecoder()
104104
avcodec_free_context(&m_codec_context);
105105
}
106106

107-
DecoderErrorOr<void> FFmpegVideoDecoder::receive_sample(AK::Duration timestamp, ReadonlyBytes sample)
107+
DecoderErrorOr<void> FFmpegVideoDecoder::receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data)
108108
{
109-
VERIFY(sample.size() < NumericLimits<int>::max());
109+
VERIFY(coded_data.size() < NumericLimits<int>::max());
110110

111-
m_packet->data = const_cast<u8*>(sample.data());
112-
m_packet->size = static_cast<int>(sample.size());
111+
m_packet->data = const_cast<u8*>(coded_data.data());
112+
m_packet->size = static_cast<int>(coded_data.size());
113113
m_packet->pts = timestamp.to_microseconds();
114114
m_packet->dts = m_packet->pts;
115115

Libraries/LibMedia/FFmpeg/FFmpegVideoDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MEDIA_API FFmpegVideoDecoder final : public VideoDecoder {
2020
FFmpegVideoDecoder(AVCodecContext* codec_context, AVPacket* packet, AVFrame* frame);
2121
~FFmpegVideoDecoder();
2222

23-
DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ReadonlyBytes sample) override;
23+
DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data) override;
2424
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() override;
2525

2626
void flush() override;

Libraries/LibMedia/PlaybackManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void PlaybackManager::decode_and_queue_one_sample()
218218
container_cicp = sample.auxiliary_data().get<CodedVideoFrameData>().container_cicp();
219219

220220
// Submit the sample to the decoder.
221-
auto decode_result = m_decoder->receive_sample(sample.timestamp(), sample.data());
221+
auto decode_result = m_decoder->receive_coded_data(sample.timestamp(), sample.data());
222222
if (decode_result.is_error()) {
223223
item_to_enqueue = FrameQueueItem::error_marker(decode_result.release_error(), sample.timestamp());
224224
break;

Libraries/LibMedia/VideoDecoder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class VideoDecoder {
1818
public:
1919
virtual ~VideoDecoder() { }
2020

21-
virtual DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ReadonlyBytes sample) = 0;
22-
DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ByteBuffer const& sample) { return receive_sample(timestamp, sample.span()); }
21+
virtual DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data) = 0;
22+
DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ByteBuffer const& coded_data) { return receive_coded_data(timestamp, coded_data.span()); }
2323
virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
2424

2525
virtual void flush() = 0;

Tests/LibMedia/TestMediaCommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static inline void decode_video(StringView path, size_t expected_frame_count, T
3939

4040
auto block = block_result.release_value();
4141
for (auto const& frame : block.frames()) {
42-
MUST(decoder->receive_sample(block.timestamp(), frame));
42+
MUST(decoder->receive_coded_data(block.timestamp(), frame));
4343
while (true) {
4444
auto frame_result = decoder->get_decoded_frame();
4545
if (frame_result.is_error()) {

0 commit comments

Comments
 (0)