| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 stats->file = fdopen(fd, "rb"); | 34 stats->file = fdopen(fd, "rb"); |
| 35 fstat(fd, &stat_buf); | 35 fstat(fd, &stat_buf); |
| 36 stats->buf.sz = stat_buf.st_size; | 36 stats->buf.sz = stat_buf.st_size; |
| 37 stats->buf.buf = mmap(NULL, stats->buf.sz, PROT_READ, MAP_PRIVATE, fd, 0); | 37 stats->buf.buf = mmap(NULL, stats->buf.sz, PROT_READ, MAP_PRIVATE, fd, 0); |
| 38 res = (stats->buf.buf != NULL); | 38 res = (stats->buf.buf != NULL); |
| 39 #else | 39 #else |
| 40 size_t nbytes; | 40 size_t nbytes; |
| 41 | 41 |
| 42 stats->file = fopen(fpf, "rb"); | 42 stats->file = fopen(fpf, "rb"); |
| 43 | 43 |
| 44 if (stats->file == NULL) | |
| 45 fatal("First-pass stats file does not exist!"); | |
| 46 | |
| 47 if (fseek(stats->file, 0, SEEK_END)) | 44 if (fseek(stats->file, 0, SEEK_END)) |
| 48 fatal("First-pass stats file must be seekable!"); | 45 fatal("First-pass stats file must be seekable!"); |
| 49 | 46 |
| 50 stats->buf.sz = stats->buf_alloc_sz = ftell(stats->file); | 47 stats->buf.sz = stats->buf_alloc_sz = ftell(stats->file); |
| 51 rewind(stats->file); | 48 rewind(stats->file); |
| 52 | 49 |
| 53 stats->buf.buf = malloc(stats->buf_alloc_sz); | 50 stats->buf.buf = malloc(stats->buf_alloc_sz); |
| 54 | 51 |
| 55 if (!stats->buf.buf) | 52 if (!stats->buf.buf) |
| 56 fatal("Failed to allocate first-pass stats buffer (%lu bytes)", | 53 fatal("Failed to allocate first-pass stats buffer (%lu bytes)", |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 113 |
| 117 memcpy(stats->buf_ptr, pkt, len); | 114 memcpy(stats->buf_ptr, pkt, len); |
| 118 stats->buf.sz += len; | 115 stats->buf.sz += len; |
| 119 stats->buf_ptr += len; | 116 stats->buf_ptr += len; |
| 120 } | 117 } |
| 121 } | 118 } |
| 122 | 119 |
| 123 vpx_fixed_buf_t stats_get(stats_io_t *stats) { | 120 vpx_fixed_buf_t stats_get(stats_io_t *stats) { |
| 124 return stats->buf; | 121 return stats->buf; |
| 125 } | 122 } |
| OLD | NEW |