mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 19:44:46 +00:00
avplayer: removed all waits from GetVideoData
This commit is contained in:
parent
cba5111288
commit
a6dc82e076
3 changed files with 13 additions and 13 deletions
|
@ -19,7 +19,7 @@ s32 PS4_SYSV_ABI sceAvPlayerAddSource(AvPlayerHandle handle, const char* filenam
|
|||
|
||||
s32 PS4_SYSV_ABI sceAvPlayerAddSourceEx(AvPlayerHandle handle, AvPlayerUriType uri_type,
|
||||
AvPlayerSourceDetails* source_details) {
|
||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
||||
LOG_TRACE(Lib_AvPlayer, "called");
|
||||
if (handle == nullptr || uri_type != AvPlayerUriType::Source) {
|
||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ s32 PS4_SYSV_ABI sceAvPlayerJumpToTime(AvPlayerHandle handle, uint64_t time) {
|
|||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceAvPlayerPause(AvPlayerHandle handle) {
|
||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
||||
LOG_TRACE(Lib_AvPlayer, "called");
|
||||
if (handle == nullptr) {
|
||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ s32 PS4_SYSV_ABI sceAvPlayerPrintf(const char* format, ...) {
|
|||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceAvPlayerResume(AvPlayerHandle handle) {
|
||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
||||
LOG_TRACE(Lib_AvPlayer, "called");
|
||||
if (handle == nullptr) {
|
||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ s32 PS4_SYSV_ABI sceAvPlayerResume(AvPlayerHandle handle) {
|
|||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceAvPlayerSetAvSyncMode(AvPlayerHandle handle, AvPlayerAvSyncMode sync_mode) {
|
||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
||||
LOG_TRACE(Lib_AvPlayer, "called");
|
||||
if (handle == nullptr) {
|
||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,10 @@ public:
|
|||
m_queue.emplace(std::forward<T>(value));
|
||||
}
|
||||
|
||||
T& Front() {
|
||||
return m_queue.front();
|
||||
}
|
||||
|
||||
std::optional<T> Pop() {
|
||||
if (Size() == 0) {
|
||||
return std::nullopt;
|
||||
|
|
|
@ -291,10 +291,6 @@ void AvPlayerSource::Resume() {
|
|||
}
|
||||
|
||||
bool AvPlayerSource::GetVideoData(AvPlayerFrameInfo& video_info) {
|
||||
if (!IsActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AvPlayerFrameInfoEx info{};
|
||||
if (!GetVideoData(info)) {
|
||||
return false;
|
||||
|
@ -317,18 +313,18 @@ bool AvPlayerSource::GetVideoData(AvPlayerFrameInfoEx& video_info) {
|
|||
return false;
|
||||
}
|
||||
|
||||
auto frame = m_video_frames.Pop();
|
||||
const auto& last_frame = m_video_frames.Front();
|
||||
if (m_state.GetSyncMode() == AvPlayerAvSyncMode::Default) {
|
||||
const auto current_time =
|
||||
m_audio_stream_index.has_value() ? m_last_audio_packet_time : CurrentTime();
|
||||
if (0 < current_time && current_time < frame->info.timestamp) {
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(frame->info.timestamp - current_time));
|
||||
if (0 < current_time && current_time < last_frame.info.timestamp) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// return the buffer to the queue
|
||||
auto frame = m_video_frames.Pop();
|
||||
if (m_current_video_frame.has_value()) {
|
||||
// return the buffer to the queue
|
||||
m_video_buffers.Push(std::move(m_current_video_frame.value()));
|
||||
m_video_buffers_cv.Notify();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue