This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

[asf] When reading broadcast streams, we have an infinite number of p…

…ackets available.
  • Loading branch information...
rolfbjarne committed May 9, 2011
1 parent f6d5193 commit 94acff3ff4c0c866cb81e355b085593c9b40b41d
View
@@ -385,6 +385,9 @@ ASFDemuxer::SeekAsyncInternal (guint64 pts)
guint64
ASFDemuxer::GetPacketCount ()
{
+ if (file_properties->IsBroadcast ())
+ return G_MAXUINT64;
+
return file_properties->data_packet_count;
}
@@ -726,8 +729,8 @@ ASFDemuxer::ReadHeaderObject (MemoryBuffer *source, char **error_message, guint3
data_packet_count = source->ReadLE_U64 ();
source->ReadLE_U16 (); /* reserved field */
- LOG_ASF ("ASFDemuxer::ReadHeader (): Success: data_object_size: %" G_GINT64_FORMAT " data_packet_count: %" G_GINT64_FORMAT "\n",
- data_object_size, data_packet_count);
+ LOG_ASF ("ASFDemuxer::ReadHeader (): Success: data_object_size: %" G_GINT64_FORMAT " data_packet_count: %" G_GINT64_FORMAT " IsBroadcast: %i\n",
+ data_object_size, data_packet_count, file_properties->IsBroadcast ());
header_read = true;
@@ -0,0 +1,98 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Video seek test</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../js/js/utils.js"></script>
+ <script src="../../js/js/testplugin.js"></script>
+</head>
+<body scroll="no" style='border-width: 0px'>
+
+<script type="text/xaml" id="xaml">
+ <?xml version="1.0"?>
+ <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="1280" Height="720">
+ <MediaElement x:Name="TestVideo" MediaOpened="OnMediaOpened" MediaFailed="OnMediaFailed" MediaEnded="OnMediaEnded" Source="timecode-short-broadcast.wmv" AutoPlay="true"/>
+ </Canvas>
+</script>
+
+<script type="text/javascript">
+ var done = false;
+ var seeked = false;
+ var result = true;
+ var ready = true;
+ var mediaElement = null;
+ var plugin = null;
+ var ended_count = 0;
+
+ /*
+ * Test case for a bug where calling Play right after Stop ended up with a media element which wouldn't do anything at all.
+ */
+
+ function OnTestPluginReady ()
+ {
+ }
+
+ function OnPluginError (sender, args)
+ {
+ TestLogger.LogError (ErrorEventArgsToOneLineString (args));
+ TestLogger.LogResult (-1);
+ TestHost.SignalShutdown (document.name);
+ }
+
+ function OnPluginLoaded (o, e)
+ {
+ TestLogger.LogDebug ("OnPluginLoaded");
+ plugin = document.getElementById ("_MoonlightControl");
+ }
+
+ function OnMediaOpened (me, e)
+ {
+ TestLogger.LogDebug ("OnMediaOpened");
+ }
+
+ /*
+ * The testing logic here is a bit backwards:
+ * asf files with the broadcast bit set used to be treated as an empty file, and it ended immediately.
+ * now they're treated as having an infinite size, eventually causing an error when the end of the file is reached.
+ * so we pass this test if MediaFailed is raised (since we reached the end of the file).
+ * one day ML will hopefully be fixed to handle eof properly (and this test would have to be changed).
+ */
+
+ function OnMediaFailed (obj, args)
+ {
+ TestLogger.LogDebug ("OnMediaFailed");
+ TestLogger.LogResult (1)
+ TestHost.SignalShutdown (document.name);
+ }
+
+ function OnMediaEnded (obj, args)
+ {
+ TestLogger.LogError ("OnMediaEnded: test failed!");
+ TestLogger.LogResult (-1);
+ TestLogger.SignalShutdown ();
+ }
+
+ function onTimeout ()
+ {
+ if (ShutdownRequested)
+ return;
+
+ TestLogger.LogError ("Test timed out.");
+ TestLogger.LogResult (-1);
+ TestLogger.SignalShutdown ();
+ }
+</script>
+
+<div>
+<embed type="application/x-silverlight" width="1280" height="720"
+ id="_MoonlightControl" Source="#xaml" OnError="OnPluginError" OnLoad="OnPluginLoaded"
+ style="position:absolute; left:0px; top:0px" background="#CCCCCC">
+</embed>
+</div>
+
+</body>
+
+</html>
+
+
+
+
Binary file not shown.

0 comments on commit 94acff3

Please sign in to comment.