aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Plate <elupus@ecce.se>2014-06-01 15:24:14 +0200
committerJoakim Plate <elupus@ecce.se>2014-06-01 15:38:06 +0200
commit9fabae2973792279500586e3b98b522c648ea6a6 (patch)
tree90e43ed72cb760474534f4c0bd2affc0102741d5
parentfaab9716b8b838c47e8bdb2588ea0ee2c8a63fda (diff)
dvdplayer: keep copy of internal state of dvdplayeraudio
This avoids external threads messing with internal objects like audio renderers.
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerAudio.cpp12
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerAudio.h15
2 files changed, 22 insertions, 5 deletions
diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
index be8214ab59..cdfc1cc0f5 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
@@ -475,8 +475,13 @@ void CDVDPlayerAudio::UpdatePlayerInfo()
s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB";
+ SInfo info;
+ info.info = s.str();
+ info.pts = m_dvdAudio.GetPlayingPts();
+ info.passthrough = m_pAudioCodec && m_pAudioCodec->NeedPassthrough();
+
{ CSingleLock lock(m_info_section);
- m_info = s.str();
+ m_info = info;
}
}
@@ -781,7 +786,7 @@ bool CDVDPlayerAudio::SwitchCodecIfNeeded()
string CDVDPlayerAudio::GetPlayerInfo()
{
CSingleLock lock(m_info_section);
- return m_info;
+ return m_info.info;
}
int CDVDPlayerAudio::GetAudioBitrate()
@@ -791,5 +796,6 @@ int CDVDPlayerAudio::GetAudioBitrate()
bool CDVDPlayerAudio::IsPassthrough() const
{
- return m_pAudioCodec && m_pAudioCodec->NeedPassthrough();
+ CSingleLock lock(m_info_section);
+ return m_info.passthrough;
}
diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h
index 4b48514aa7..81e28c13d8 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h
+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h
@@ -142,7 +142,7 @@ public:
CPTSOutputQueue m_ptsOutput;
CPTSInputQueue m_ptsInput;
- double GetCurrentPts() { return m_dvdAudio.GetPlayingPts(); }
+ double GetCurrentPts() { CSingleLock lock(m_info_section); return m_info.pts; }
bool IsStalled() { return m_stalled; }
bool IsPassthrough() const;
@@ -230,8 +230,19 @@ protected:
double m_maxspeedadjust;
double m_resampleratio; //resample ratio when using SYNC_RESAMPLE, used for the codec info
+ struct SInfo
+ {
+ SInfo()
+ : pts(DVD_NOPTS_VALUE)
+ , passthrough(false)
+ {}
+
+ std::string info;
+ double pts;
+ bool passthrough;
+ };
CCriticalSection m_info_section;
- std::string m_info;
+ SInfo m_info;
};