[Red5commits] [1813] fixed wrong timestamps of NS.Play.Switch and NS.Play.Complete

jbauch luke at codegent.com
Sun Apr 1 12:30:07 EDT 2007


fixed wrong timestamps of NS.Play.Switch and NS.Play.Complete


Timestamp: 04/01/07 11:24:56 EST (less than one hour ago) 
Change: 1813 
Author: jbauch

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1813

Index: /java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java
===================================================================
--- /java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java (revision 1808)
+++ /java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java (revision 1813)
@@ -902,4 +902,9 @@
 				// NetStream.Play.Start
 				msg = msgIn.pullMessage();
+				if (msg instanceof RTMPMessage) {
+					// Adjust timestamp when playing lists
+					final IRTMPEvent body = ((RTMPMessage) msg).getBody();
+					body.setTimestamp(body.getTimestamp() + timestampOffset);
+				}
 			}
 			if (sendNotifications) {
@@ -1056,5 +1061,4 @@
 			state = State.STOPPED;
 			notifyItemStop(currentItem);
-			sendClearPing();
 			clearWaitJobs();
 			if (!hasMoreItems()) {
@@ -1063,9 +1067,10 @@
 				bwController.resetBuckets(bwContext);
 				isWaitingForToken = false;
-				sendStopStatus(currentItem);
 				if (getItemSize() > 0) {
 					sendCompleteStatus();
 				}
 				bytesSent = 0;
+				sendClearPing();
+				sendStopStatus(currentItem);
 			} else {
 				if (lastMessage != null) {
@@ -1213,6 +1218,5 @@
 			} else {
 				if (currentItem.getLength() > 0) {
-					int duration = message.getBody().getTimestamp()
-							- vodStartTS - timestampOffset;
+					int duration = message.getBody().getTimestamp() - vodStartTS;
 					if (duration >= currentItem.getLength()) {
 						// Sent enough data to client
@@ -1330,7 +1334,5 @@
 			IRTMPEvent event = new Notify(buf);
 			if (lastMessage != null) {
-				int timestamp = lastMessage.getTimestamp() - timestampOffset;
-				if (timestamp > 0)
-					timestamp -= 1;
+				int timestamp = lastMessage.getTimestamp();
 				event.setTimestamp(timestamp);
 			} else {
@@ -1340,4 +1342,5 @@
 			msg.setBody(event);
 			msgOut.pushMessage(msg);
+			getStreamFlow().update(msg);
 		}
 		


Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list