summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-03-30 00:03:07 +0000
committerDave Chapman <dave@dchapman.com>2007-03-30 00:03:07 +0000
commit16fa5a9f014a8cb7368fbcbc943695a60729e091 (patch)
tree41aabc678002018431004b4ffe019b6e8e39e75f /apps
parent4d28b2f04314e4f3c4b96cc61153efb62bd41cf2 (diff)
Be less aggressive when dropping frames - mpegplayer was dropping any frame which was decoded more than 1/20th of a second late, change that to 3/20th second (150ms), giving noticably smoother video. Also process PTS values when dealing with MPEG-1 program streams
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12967 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 00f0090841..a7157538ea 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -512,10 +512,17 @@ static void get_next_data( Stream* str )
pts = (((ptsbuf[-1] >> 1) << 30) |
(ptsbuf[0] << 22) | ((ptsbuf[1] >> 1) << 15) |
(ptsbuf[2] << 7) | (ptsbuf[3] >> 1));
+
+ if (str->first_pts==0)
+ str->first_pts = pts;
+
+ str->curr_pts = pts;
+
dts = (((ptsbuf[-1] & 0xf0) != 0x30) ? pts :
((uint32_t)(((ptsbuf[4] >> 1) << 30) |
(ptsbuf[5] << 22) | ((ptsbuf[6] >> 1) << 15) |
(ptsbuf[7] << 7) | (ptsbuf[18] >> 1))));
+
if( stream >= 0xe0 )
mpeg2_tag_picture (mpeg2dec, pts, dts);
}
@@ -717,7 +724,8 @@ static void audio_thread(void)
apts_samples = (audio_str.curr_pts-audio_str.first_pts);
apts_samples *= 44100;
apts_samples /= 90000;
- delay=(int)(avdelay+apts_samples-samplesdecoded);
+ delay = (int)(avdelay+apts_samples-samplesdecoded);
+ //DEBUGF("delay=%d\n",delay);
}
if (framelength > 0) {
@@ -902,10 +910,11 @@ static void video_thread(void)
}
}
- /* If we are more than 1/20 second behind schedule (and
- more than 1/20 second into the decoding), skip frame */
- if (settings.skipframes && (s > (44100/20)) &&
- (eta2 < (s - (44100/20))) && (skipcount < 10)) {
+ /* If we are more than 3/20 second behind schedule (and
+ more than 3/20 second into the decoding), skip frame.
+ But don't skip more than 10 consecutive frames. */
+ if (settings.skipframes && (s > ((3*44100)/20)) &&
+ (eta2 < (s - ((3*44100)/20))) && (skipcount < 10)) {
skipped++;
skipcount++;
} else {