summaryrefslogtreecommitdiff
path: root/indra/llplugin
diff options
context:
space:
mode:
authorskolb <none@none>2009-10-15 13:58:16 -0700
committerskolb <none@none>2009-10-15 13:58:16 -0700
commite9f7205ba9f4dfb3422759218609b62d61972722 (patch)
treee7859943f67b0ab2f8e132cd64c0effbb3462206 /indra/llplugin
parent1b1550f284316b244a10a4a6604fedb5d6b18965 (diff)
parent050ae3cf5107140a58f6aeae865d254b74a23d44 (diff)
Merge fix for DEV-39832
Diffstat (limited to 'indra/llplugin')
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp23
-rw-r--r--indra/llplugin/llpluginclassmedia.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index e019cdcf21..2a343fd0c9 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -133,6 +133,7 @@ void LLPluginClassMedia::reset()
mCurrentTime = 0.0f;
mDuration = 0.0f;
mCurrentRate = 0.0f;
+ mLoadedDuration = 0.0f;
}
void LLPluginClassMedia::idle(void)
@@ -705,6 +706,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
bool time_duration_updated = false;
+ int previous_percent = mProgressPercent;
if(message.hasValue("current_time"))
{
@@ -722,11 +724,32 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mCurrentRate = message.getValueReal("current_rate");
}
+ if(message.hasValue("loaded_duration"))
+ {
+ mLoadedDuration = message.getValueReal("loaded_duration");
+ time_duration_updated = true;
+ }
+ else
+ {
+ // If the message doesn't contain a loaded_duration param, assume it's equal to duration
+ mLoadedDuration = mDuration;
+ }
+
+ // Calculate a percentage based on the loaded duration and total duration.
+ if(mDuration != 0.0f) // Don't divide by zero.
+ {
+ mProgressPercent = (int)((mLoadedDuration * 100.0f)/mDuration);
+ }
+
if(time_duration_updated)
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_TIME_DURATION_UPDATED);
}
+ if(previous_percent != mProgressPercent)
+ {
+ mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PROGRESS_UPDATED);
+ }
}
else if(message_name == "media_status")
{
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 97f2a11ef2..697deec353 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -231,6 +231,7 @@ public:
F64 getCurrentTime(void) const { return mCurrentTime; };
F64 getDuration(void) const { return mDuration; };
F64 getCurrentPlayRate(void) { return mCurrentRate; };
+ F64 getLoadedDuration(void) const { return mLoadedDuration; };
// Initialize the URL history of the plugin by sending
// "init_history" message
@@ -339,6 +340,7 @@ protected:
F64 mCurrentTime;
F64 mDuration;
F64 mCurrentRate;
+ F64 mLoadedDuration;
};