mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
libavcodec apparently holds onto any error that is not AVERROR_EOF when a read fails. This means that reading until EOF after an aborted read results in us receiving an AVERROR_EXIT in FFmpegDemuxer instead of AVERROR_EOF, which causes the playback system to enter an error state without decoding all frames in the file. Instead, just always return AVERROR_EOF, and check if the read was aborted in FFmpegDemuxer instead to return the correct error category from there.
39 lines
950 B
C++
39 lines
950 B
C++
/*
|
|
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/AtomicRefCounted.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <AK/Stream.h>
|
|
#include <LibMedia/DecoderError.h>
|
|
|
|
namespace Media {
|
|
|
|
class MediaStreamCursor : public AtomicRefCounted<MediaStreamCursor> {
|
|
public:
|
|
virtual ~MediaStreamCursor() = default;
|
|
|
|
virtual DecoderErrorOr<void> seek(i64 offset, SeekMode) = 0;
|
|
virtual DecoderErrorOr<size_t> read_into(Bytes) = 0;
|
|
virtual size_t position() const = 0;
|
|
virtual size_t size() const = 0;
|
|
|
|
virtual void abort() { }
|
|
virtual void reset_abort() { }
|
|
virtual bool is_aborted() const { return false; }
|
|
virtual bool is_blocked() const { return false; }
|
|
};
|
|
|
|
class MediaStream : public AtomicRefCounted<MediaStream> {
|
|
public:
|
|
virtual ~MediaStream() = default;
|
|
|
|
virtual NonnullRefPtr<MediaStreamCursor> create_cursor() = 0;
|
|
};
|
|
|
|
}
|