mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-26 11:45:26 +00:00
Merge pull request #1150 from unknownbrackets/mpeg-fix
Reset video pts when registering new streams
This commit is contained in:
commit
28b38ab9b6
@ -155,6 +155,7 @@ struct StreamInfo {
|
||||
int type;
|
||||
int num;
|
||||
int sid;
|
||||
bool needsReset;
|
||||
};
|
||||
|
||||
typedef std::map<u32, StreamInfo> StreamInfoMap;
|
||||
@ -618,6 +619,7 @@ int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum)
|
||||
StreamInfo info;
|
||||
info.type = streamType;
|
||||
info.num = streamNum;
|
||||
info.needsReset = true;
|
||||
ctx->streamMap[sid] = info;
|
||||
return sid;
|
||||
}
|
||||
@ -813,6 +815,7 @@ u32 sceMpegUnRegistStream(u32 mpeg, int streamUid)
|
||||
ctx->streamMap[streamUid] = info;
|
||||
info.type = -1;
|
||||
info.sid = -1 ;
|
||||
info.needsReset = true;
|
||||
ctx->isAnalyzed = false;
|
||||
return 0;
|
||||
}
|
||||
@ -1008,14 +1011,6 @@ int sceMpegRingbufferAvailableSize(u32 ringbufferAddr)
|
||||
SceMpegRingBuffer ringbuffer;
|
||||
Memory::ReadStruct(ringbufferAddr, &ringbuffer);
|
||||
DEBUG_LOG(HLE, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer.packetsFree, ringbufferAddr);
|
||||
|
||||
static int c = 0;
|
||||
if (ringbuffer.packetsFree == 0)
|
||||
c++;
|
||||
else
|
||||
c = 0;
|
||||
//if (c > 1000)
|
||||
//hleDebugBreak();
|
||||
return ringbuffer.packetsFree;
|
||||
}
|
||||
|
||||
@ -1102,12 +1097,19 @@ int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
|
||||
return PSP_ERROR_MPEG_NO_DATA;
|
||||
}
|
||||
|
||||
if (ctx->streamMap.find(streamId) == ctx->streamMap.end())
|
||||
auto streamInfo = ctx->streamMap.find(streamId);
|
||||
if (streamInfo == ctx->streamMap.end())
|
||||
{
|
||||
ERROR_LOG(HLE, "sceMpegGetAvcAu - bad stream id %i", streamId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (streamInfo->second.needsReset)
|
||||
{
|
||||
sceAu.pts = 0;
|
||||
streamInfo->second.needsReset = false;
|
||||
}
|
||||
|
||||
// Wait for audio if too much ahead
|
||||
if (ctx->atracRegistered && (sceAu.pts > sceAu.pts + getMaxAheadTimestamp(mpegRingbuffer)))
|
||||
{
|
||||
@ -1174,6 +1176,13 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
|
||||
SceMpegAu sceAu;
|
||||
sceAu.read(auAddr);
|
||||
|
||||
auto streamInfo = ctx->streamMap.find(streamId);
|
||||
if (streamInfo != ctx->streamMap.end() && streamInfo->second.needsReset)
|
||||
{
|
||||
sceAu.pts = 0;
|
||||
streamInfo->second.needsReset = false;
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
|
||||
if (mpegRingbuffer.packetsFree == mpegRingbuffer.packets) {
|
||||
@ -1228,7 +1237,7 @@ u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode)
|
||||
// NOTE: Where is the info supposed to come from?
|
||||
StreamInfo info = {0};
|
||||
info.sid = streamUid;
|
||||
if (info.sid) {
|
||||
if (info.sid) {
|
||||
switch (info.type) {
|
||||
case MPEG_AVC_STREAM:
|
||||
if(mode == MPEG_AU_MODE_DECODE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user