Changeset 950110ee in mainline for uspace/srv/audio/hound/audio_source.c
- Timestamp:
- 2012-07-17T07:33:43Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ea6c838
- Parents:
- 389ef25
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_source.c
r389ef25 r950110ee 120 120 return ENOTSUP; 121 121 } 122 const size_t src_frame_size = audio_format_frame_size(&source->format); 123 const size_t dst_frames = size / audio_format_frame_size(f); 124 122 125 if (source->available_data.position == NULL || 123 126 source->available_data.size == 0) { 124 127 int ret = EOVERFLOW; /* In fact this is underflow... */ 125 128 if (source->update_available_data) 126 ret = source->update_available_data(source, size); 129 ret = source->update_available_data(source, 130 dst_frames * src_frame_size); 127 131 if (ret != EOK) { 128 132 log_debug("No data to add to %p(%zu)", buffer, size); … … 131 135 } 132 136 133 const size_t real_size = min(size, source->available_data.size);134 const int ret =135 audio_format_mix(buffer, source->available_data.position, real_size, f);137 const int ret = audio_format_convert_and_mix(buffer, size, 138 source->available_data.position, source->available_data.size, 139 &source->format, f); 136 140 if (ret != EOK) { 137 log_debug("Mixing failed %p <= %p, %zu",138 buffer, source->available_data.position, real_size);141 log_debug("Mixing failed %p <= %p, frames: %zu", 142 buffer, source->available_data.position, dst_frames); 139 143 return ret; 140 144 } 141 145 142 source->available_data.position += real_size; 143 source->available_data.size -= real_size; 144 145 // log_verbose("Mixing successful %p <= %p, %zu", 146 // buffer, source->available_data.position, real_size); 147 148 buffer += real_size; 149 size -= real_size; 150 151 //TODO update data again 152 if (size) 153 log_warning("not enough data"); 154 146 source->available_data.position += (dst_frames * src_frame_size); 147 source->available_data.size -= (dst_frames * src_frame_size); 155 148 return EOK; 156 149 }
Note:
See TracChangeset
for help on using the changeset viewer.