Changeset 60b307b4bc1ec3422daa3f5b75bef3eeaad0a04d
- Timestamp:
- 16/12/05 18:28:36
(3 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1134754116 +0000
- git-parent:
[1f61d23a127e0686aa6b2d5e3afdbd11d9ffcbc5]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1134754116 +0000
- Message:
Refill stream when seeking near of end of track.
Needs testing and review
+ allow enabling of debug through #define STREAM_DEBUG
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3a65334 |
r60b307b |
|
| 28 | 28 | #include "input_internal.h" |
|---|
| 29 | 29 | |
|---|
| | 30 | #undef STREAM_DEBUG |
|---|
| | 31 | |
|---|
| 30 | 32 | /* TODO: |
|---|
| 31 | 33 | * - tune the 2 methods |
|---|
| … | … | |
| 624 | 626 | } |
|---|
| 625 | 627 | |
|---|
| 626 | | if( p_access->info.b_prebuffered ) |
|---|
| | 628 | if( p_access->info.b_prebuffered ) |
|---|
| 627 | 629 | { |
|---|
| 628 | 630 | /* Access has already prebufferred - update stats and exit */ |
|---|
| … | … | |
| 998 | 1000 | } |
|---|
| 999 | 1001 | |
|---|
| 1000 | | #if 0 |
|---|
| | 1002 | #ifdef STREAM_DEBUG |
|---|
| 1001 | 1003 | msg_Dbg( s, "AStreamReadStream: %d pos="I64Fd" tk=%d start="I64Fd |
|---|
| 1002 | 1004 | " offset=%d end="I64Fd, |
|---|
| … | … | |
| 1053 | 1055 | if( tk->i_start >= tk->i_end ) return 0; /* EOF */ |
|---|
| 1054 | 1056 | |
|---|
| 1055 | | #if 0 |
|---|
| | 1057 | #ifdef STREAM_DEBUG |
|---|
| 1056 | 1058 | msg_Dbg( s, "AStreamPeekStream: %d pos="I64Fd" tk=%d " |
|---|
| 1057 | 1059 | "start="I64Fd" offset=%d end="I64Fd, |
|---|
| … | … | |
| 1116 | 1118 | int i; |
|---|
| 1117 | 1119 | |
|---|
| 1118 | | #if 0 |
|---|
| | 1120 | #ifdef STREAM_DEBUG |
|---|
| 1119 | 1121 | msg_Dbg( s, "AStreamSeekStream: to "I64Fd" pos="I64Fd |
|---|
| 1120 | 1122 | "tk=%d start="I64Fd" offset=%d end="I64Fd, |
|---|
| … | … | |
| 1130 | 1132 | i_pos < p_sys->stream.tk[p_sys->stream.i_tk].i_end ) |
|---|
| 1131 | 1133 | { |
|---|
| 1132 | | //msg_Dbg( s, "AStreamSeekStream: current track" ); |
|---|
| | 1134 | stream_track_t *tk = &p_sys->stream.tk[p_sys->stream.i_tk]; |
|---|
| | 1135 | #ifdef STREAM_DEBUG |
|---|
| | 1136 | msg_Dbg( s, "AStreamSeekStream: current track" ); |
|---|
| | 1137 | #endif |
|---|
| 1133 | 1138 | p_sys->i_pos = i_pos; |
|---|
| 1134 | | p_sys->stream.i_offset = i_pos - p_sys->stream.tk[p_sys->stream.i_tk].i_start; |
|---|
| | 1139 | p_sys->stream.i_offset = i_pos - tk->i_start; |
|---|
| | 1140 | |
|---|
| | 1141 | /* If there is not enough data left in the track, refill */ |
|---|
| | 1142 | /* \todo How to get a correct value for |
|---|
| | 1143 | * - refilling threshold |
|---|
| | 1144 | * - how much to refill |
|---|
| | 1145 | */ |
|---|
| | 1146 | if( (tk->i_end - tk->i_start ) - p_sys->stream.i_offset < |
|---|
| | 1147 | p_sys->stream.i_read_size ) |
|---|
| | 1148 | { |
|---|
| | 1149 | if( p_sys->stream.i_used < STREAM_READ_ATONCE / 2 ) |
|---|
| | 1150 | { |
|---|
| | 1151 | p_sys->stream.i_used = STREAM_READ_ATONCE / 2 ; |
|---|
| | 1152 | if( AStreamRefillStream( s ) ) |
|---|
| | 1153 | return VLC_EGENERIC; |
|---|
| | 1154 | } |
|---|
| | 1155 | } |
|---|
| 1135 | 1156 | return VLC_SUCCESS; |
|---|
| 1136 | 1157 | } |
|---|
| … | … | |
| 1154 | 1175 | if( i_pos >= tk->i_start && i_pos <= tk->i_end ) |
|---|
| 1155 | 1176 | { |
|---|
| 1156 | | #if 0 |
|---|
| | 1177 | #ifdef STREAM_DEBUG |
|---|
| 1157 | 1178 | msg_Dbg( s, "AStreamSeekStream: reusing %d start="I64Fd |
|---|
| 1158 | 1179 | " end="I64Fd, i, tk->i_start, tk->i_end ); |
|---|
| 1159 | 1180 | #endif |
|---|
| | 1181 | |
|---|
| 1160 | 1182 | /* Seek at the end of the buffer */ |
|---|
| 1161 | 1183 | if( ASeek( s, tk->i_end ) ) return VLC_EGENERIC; |
|---|
| … | … | |
| 1241 | 1263 | if( i_toread <= 0 ) return VLC_EGENERIC; /* EOF */ |
|---|
| 1242 | 1264 | |
|---|
| 1243 | | /* msg_Dbg( s, "AStreamRefillStream: toread=%d", i_toread ); */ |
|---|
| | 1265 | #ifdef STREAM_DEBUG |
|---|
| | 1266 | msg_Dbg( s, "AStreamRefillStream: used=%d toread=%d", |
|---|
| | 1267 | p_sys->stream.i_used, i_toread ); |
|---|
| | 1268 | #endif |
|---|
| 1244 | 1269 | |
|---|
| 1245 | 1270 | i_start = mdate(); |
|---|