mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 18:45:36 +00:00
avplayer: removed all waits from GetVideoData
This commit is contained in:
parent
dfb14018b4
commit
33140095c4
@ -19,7 +19,7 @@ s32 PS4_SYSV_ABI sceAvPlayerAddSource(AvPlayerHandle handle, const char* filenam
|
|||||||
|
|
||||||
s32 PS4_SYSV_ABI sceAvPlayerAddSourceEx(AvPlayerHandle handle, AvPlayerUriType uri_type,
|
s32 PS4_SYSV_ABI sceAvPlayerAddSourceEx(AvPlayerHandle handle, AvPlayerUriType uri_type,
|
||||||
AvPlayerSourceDetails* source_details) {
|
AvPlayerSourceDetails* source_details) {
|
||||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
LOG_TRACE(Lib_AvPlayer, "called");
|
||||||
if (handle == nullptr || uri_type != AvPlayerUriType::Source) {
|
if (handle == nullptr || uri_type != AvPlayerUriType::Source) {
|
||||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
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) {
|
s32 PS4_SYSV_ABI sceAvPlayerPause(AvPlayerHandle handle) {
|
||||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
LOG_TRACE(Lib_AvPlayer, "called");
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
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) {
|
s32 PS4_SYSV_ABI sceAvPlayerResume(AvPlayerHandle handle) {
|
||||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
LOG_TRACE(Lib_AvPlayer, "called");
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
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) {
|
s32 PS4_SYSV_ABI sceAvPlayerSetAvSyncMode(AvPlayerHandle handle, AvPlayerAvSyncMode sync_mode) {
|
||||||
LOG_TRACE(Lib_AvPlayer, "(STUBBED) called");
|
LOG_TRACE(Lib_AvPlayer, "called");
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,10 @@ public:
|
|||||||
m_queue.emplace(std::forward<T>(value));
|
m_queue.emplace(std::forward<T>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T& Front() {
|
||||||
|
return m_queue.front();
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<T> Pop() {
|
std::optional<T> Pop() {
|
||||||
if (Size() == 0) {
|
if (Size() == 0) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -291,10 +291,6 @@ void AvPlayerSource::Resume() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AvPlayerSource::GetVideoData(AvPlayerFrameInfo& video_info) {
|
bool AvPlayerSource::GetVideoData(AvPlayerFrameInfo& video_info) {
|
||||||
if (!IsActive()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AvPlayerFrameInfoEx info{};
|
AvPlayerFrameInfoEx info{};
|
||||||
if (!GetVideoData(info)) {
|
if (!GetVideoData(info)) {
|
||||||
return false;
|
return false;
|
||||||
@ -317,18 +313,18 @@ bool AvPlayerSource::GetVideoData(AvPlayerFrameInfoEx& video_info) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto frame = m_video_frames.Pop();
|
const auto& last_frame = m_video_frames.Front();
|
||||||
if (m_state.GetSyncMode() == AvPlayerAvSyncMode::Default) {
|
if (m_state.GetSyncMode() == AvPlayerAvSyncMode::Default) {
|
||||||
const auto current_time =
|
const auto current_time =
|
||||||
m_audio_stream_index.has_value() ? m_last_audio_packet_time : CurrentTime();
|
m_audio_stream_index.has_value() ? m_last_audio_packet_time : CurrentTime();
|
||||||
if (0 < current_time && current_time < frame->info.timestamp) {
|
if (0 < current_time && current_time < last_frame.info.timestamp) {
|
||||||
std::this_thread::sleep_for(
|
return false;
|
||||||
std::chrono::milliseconds(frame->info.timestamp - current_time));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the buffer to the queue
|
auto frame = m_video_frames.Pop();
|
||||||
if (m_current_video_frame.has_value()) {
|
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.Push(std::move(m_current_video_frame.value()));
|
||||||
m_video_buffers_cv.Notify();
|
m_video_buffers_cv.Notify();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user