Author: rolf
Date: 2008-02-06 17:17:19 -0500 (Wed, 06 Feb 2008)
New Revision: 95086
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/asf/ChangeLog
trunk/moon/src/asf/asf.cpp
trunk/moon/src/mplayer.cpp
Log:
* asf/asf.cpp: Free the index upon destruction.
* mplayer.cpp: Simplify our advance frame loop: don't lock the queue
during the entire loop, only when fetching packets. This allows
packets to arrive from the pipeline while in the loop (especially
noticable when decoding the video inside the loop).
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-02-06 22:00:35 UTC (rev 95085)
+++ trunk/moon/src/ChangeLog 2008-02-06 22:17:19 UTC (rev 95086)
@@ -1,3 +1,10 @@
+2008-02-06 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * mplayer.cpp: Simplify our advance frame loop: don't lock the queue
during
+ the entire loop, only when fetching packets. This allows packets to
+ arrive from the pipeline while in the loop (especially noticable when
+ decoding the video inside the loop).
+
2008-02-06 Chris Toshok <[EMAIL PROTECTED]>
* uielement.cpp (UIElement::FrontToBack): use the media state
Modified: trunk/moon/src/asf/ChangeLog
===================================================================
--- trunk/moon/src/asf/ChangeLog 2008-02-06 22:00:35 UTC (rev 95085)
+++ trunk/moon/src/asf/ChangeLog 2008-02-06 22:17:19 UTC (rev 95086)
@@ -1,5 +1,9 @@
2008-02-06 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+ * asf.cpp: Free the index upon destruction.
+
+2008-02-06 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
* asf.cpp: Fix MIN/MAX confusion.
2008-02-04 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
Modified: trunk/moon/src/asf/asf.cpp
===================================================================
--- trunk/moon/src/asf/asf.cpp 2008-02-06 22:00:35 UTC (rev 95085)
+++ trunk/moon/src/asf/asf.cpp 2008-02-06 22:17:19 UTC (rev 95086)
@@ -752,6 +752,8 @@
g_free (payloads);
}
+
+ g_free (index);
}
bool
ASFFrameReader::Eof ()
Modified: trunk/moon/src/mplayer.cpp
===================================================================
--- trunk/moon/src/mplayer.cpp 2008-02-06 22:00:35 UTC (rev 95085)
+++ trunk/moon/src/mplayer.cpp 2008-02-06 22:17:19 UTC (rev 95086)
@@ -472,12 +472,11 @@
MediaPlayer::AdvanceFrame ()
{
//printf ("MediaPlayer::AdvanceFrame ()\n");
- Packet *pkt = NULL, *npkt = NULL;
+ Packet *pkt = NULL;
MediaFrame *frame = NULL;
IMediaStream *stream;
bool update = false;
uint64_t target_pts;
- List *list;
load_frame = false;
@@ -510,77 +509,49 @@
this->target_pts = target_pts;
}
-
- video->queue->Lock ();
-
- list = video->queue->LinkedList ();
-
- if ((pkt = (Packet *) list->First ())) {
+ while ((pkt = (Packet *) video->queue->Pop ())) {
if (pkt->frame->event == FrameEventEOF) {
- list->Unlink (pkt);
delete pkt;
eof = true;
-
- video->queue->Unlock ();
-
return false;
}
- do {
- // always decode the frame or we get glitches in the
screen
- frame = pkt->frame;
- stream = frame->stream;
- update = true;
+ // always decode the frame or we get glitches in the screen
+ frame = pkt->frame;
+ stream = frame->stream;
+ update = true;
+
+ current_pts = frame->pts;
+
+ media_player_enqueue_frames (this, 0, 1);
+
+ if (!frame->IsDecoded ()) {
+ //printf ("MediaPlayer::AdvanceFrame (): decoding on
main thread.\n");
+ MediaResult result = stream->decoder->DecodeFrame
(frame);
- npkt = (Packet *) pkt->next;
-
- current_pts = frame->pts;
- list->Unlink (pkt);
-
- media_player_enqueue_frames (this, 0, 1);
-
- if (!frame->IsDecoded ()) {
- //printf ("MediaPlayer::AdvanceFrame ():
decoding on main thread.\n");
- MediaResult result =
stream->decoder->DecodeFrame (frame);
-
- if (!MEDIA_SUCCEEDED (result)) {
- printf ("MediaPlayer::AdvanceFrame ():
Couldn't decode frame.\n");
- update = false;
- }
+ if (!MEDIA_SUCCEEDED (result)) {
+ printf ("MediaPlayer::AdvanceFrame (): Couldn't
decode frame.\n");
+ update = false;
}
-
- if (update && current_pts >= target_pts) {
- caught_up_with_seek = true;
- // we are in sync (or ahead) of audio playback
- break;
- }
-
- if (!npkt) {
- // no more packets in queue, this frame is the
most recent we have available
- media_player_enqueue_frames (this, 0, 1);
- break;
- }
-
- if (npkt->frame->event == FrameEventEOF) {
- // We've reached the EOF, current
- // frame is the most recent we can
- // render
- list->Unlink (npkt);
- delete npkt;
- eof = true;
- break;
- }
-
- // we are lagging behind, drop this frame
- frame = NULL;
- delete pkt;
-
- pkt = npkt;
- } while (pkt);
+ }
+
+ if (update && current_pts >= target_pts) {
+ caught_up_with_seek = true;
+ // we are in sync (or ahead) of audio playback
+ break;
+ }
+
+ if (video->queue->IsEmpty ()) {
+ // no more packets in queue, this frame is the most
recent we have available
+ media_player_enqueue_frames (this, 0, 1);
+ break;
+ }
+
+ // we are lagging behind, drop this frame
+ frame = NULL;
+ delete pkt;
}
- video->queue->Unlock ();
-
if (update && frame && caught_up_with_seek) {
//printf ("MediaPlayer::AdvanceFrame (): rendering pts
%llu.\n", frame->pts);
render_frame (this, frame);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches