win-dshow: Add LGP timestamp fix

LGP devices are devices that induce anger in any sane developer because
they're prone to bad audio timestamps when using their decoded data
directly.  For that reason, add a hack that smooths the timestamps
within a large threshold to prevent audio skipping.
This commit is contained in:
jp9000
2017-02-22 01:18:24 -08:00
parent 5b8a0a2777
commit 32f60d07a3
3 changed files with 48 additions and 3 deletions
+10 -1
View File
@@ -116,6 +116,7 @@ public:
inline ~Decoder() {ffmpeg_decode_free(&decode);}
inline operator ffmpeg_decode*() {return &decode;}
inline ffmpeg_decode *operator->() {return &decode;}
};
class CriticalSection {
@@ -507,10 +508,18 @@ void DShowInput::OnEncodedAudioData(enum AVCodecID id,
blog(LOG_WARNING, "Could not initialize audio decoder");
return;
}
if (videoConfig.name.find(L"C875") != std::string::npos ||
videoConfig.name.find(L"C835") != std::string::npos) {
audio_decoder->fix_braindead_lgp_audio_packet_stupidity
= true;
blog(LOG_INFO, "Oh great, an LGP was detected. "
"How wonderful. I'm just ecstatic.");
}
}
bool got_output;
int len = ffmpeg_decode_audio(audio_decoder, data, size,
int len = ffmpeg_decode_audio(audio_decoder, data, size, &ts,
&audio, &got_output);
if (len < 0) {
blog(LOG_WARNING, "Error decoding audio");