Changeset 2e4d57cfa8bcdb2c3c404bfd55a396b00a1bf77b
- Timestamp:
- 18/08/08 19:37:51
(4 months ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1219081071 +0200
- git-parent:
[9aba8655bc20754bddd83c3733059c6846145826]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1219069621 +0200
- Message:
Fixed flac demuxer segfault (/0) when seektable is empty.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r132030a |
r2e4d57c |
|
| 284 | 284 | { |
|---|
| 285 | 285 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 286 | | int64_t i_next_time; |
|---|
| 287 | | int64_t i_next_offset; |
|---|
| 288 | 286 | int64_t i_delta_time; |
|---|
| 289 | | int64_t i_delta_offset; |
|---|
| 290 | 287 | bool b_seekable; |
|---|
| 291 | 288 | int i; |
|---|
| … | … | |
| 303 | 300 | break; |
|---|
| 304 | 301 | } |
|---|
| 305 | | if( i+1 < p_sys->i_seekpoint ) |
|---|
| 306 | | { |
|---|
| 307 | | i_next_time = p_sys->seekpoint[i+1]->i_time_offset; |
|---|
| 308 | | i_next_offset = p_sys->seekpoint[i+1]->i_byte_offset; |
|---|
| 309 | | } |
|---|
| 310 | | else |
|---|
| 311 | | { |
|---|
| 312 | | i_next_time = p_sys->i_length; |
|---|
| 313 | | i_next_offset = stream_Size(p_demux->s)-p_sys->i_data_pos; |
|---|
| 314 | | } |
|---|
| 315 | 302 | i_delta_time = i_time - p_sys->seekpoint[i]->i_time_offset; |
|---|
| 316 | | i_delta_offset = (i_next_offset - p_sys->seekpoint[i]->i_byte_offset) * i_delta_time / |
|---|
| 317 | | (p_sys->seekpoint[i+1]->i_time_offset-p_sys->seekpoint[i]->i_time_offset); |
|---|
| 318 | 303 | |
|---|
| 319 | 304 | /* XXX We do exact seek if it's not too far away(45s) */ |
|---|
| … | … | |
| 322 | 307 | if( stream_Seek( p_demux->s, p_sys->seekpoint[i]->i_byte_offset+p_sys->i_data_pos ) ) |
|---|
| 323 | 308 | return VLC_EGENERIC; |
|---|
| | 309 | |
|---|
| 324 | 310 | p_sys->i_time_offset = p_sys->seekpoint[i]->i_time_offset - p_sys->i_pts; |
|---|
| 325 | 311 | p_sys->i_pts_start = p_sys->i_pts+i_delta_time; |
|---|
| … | … | |
| 328 | 314 | else |
|---|
| 329 | 315 | { |
|---|
| | 316 | int64_t i_delta_offset; |
|---|
| | 317 | int64_t i_next_time; |
|---|
| | 318 | int64_t i_next_offset; |
|---|
| | 319 | |
|---|
| | 320 | if( i+1 < p_sys->i_seekpoint ) |
|---|
| | 321 | { |
|---|
| | 322 | i_next_time = p_sys->seekpoint[i+1]->i_time_offset; |
|---|
| | 323 | i_next_offset = p_sys->seekpoint[i+1]->i_byte_offset; |
|---|
| | 324 | } |
|---|
| | 325 | else |
|---|
| | 326 | { |
|---|
| | 327 | i_next_time = p_sys->i_length; |
|---|
| | 328 | i_next_offset = stream_Size(p_demux->s)-p_sys->i_data_pos; |
|---|
| | 329 | } |
|---|
| | 330 | |
|---|
| | 331 | i_delta_offset = 0; |
|---|
| | 332 | if( i_next_time-p_sys->seekpoint[i]->i_time_offset > 0 ) |
|---|
| | 333 | i_delta_offset = (i_next_offset - p_sys->seekpoint[i]->i_byte_offset) * i_delta_time / |
|---|
| | 334 | (i_next_time-p_sys->seekpoint[i]->i_time_offset); |
|---|
| | 335 | |
|---|
| 330 | 336 | if( stream_Seek( p_demux->s, p_sys->seekpoint[i]->i_byte_offset+p_sys->i_data_pos + i_delta_offset ) ) |
|---|
| 331 | 337 | return VLC_EGENERIC; |
|---|
| | 338 | |
|---|
| 332 | 339 | p_sys->i_pts_start = p_sys->i_pts; |
|---|
| 333 | 340 | p_sys->i_time_offset = (p_sys->seekpoint[i]->i_time_offset+i_delta_time) - p_sys->i_pts; |
|---|