Scope fixes: 0-init scope data; do not put critical calls into an assert() ;-)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3236 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2009-10-24 05:37:41 +00:00
parent 6774ad2a9b
commit 2362c376a4
+8 -2
View File
@@ -64,7 +64,7 @@ PlayStream (TFB_SoundSample *sample, uint32 source, bool looping, bool scope,
// realloc it a zillion times // realloc it a zillion times
soundSource[source].sbuf_size = sample->num_buffers * soundSource[source].sbuf_size = sample->num_buffers *
decoder->buffer_size + PAD_SCOPE_BYTES; decoder->buffer_size + PAD_SCOPE_BYTES;
soundSource[source].sbuffer = HMalloc (soundSource[source].sbuf_size); soundSource[source].sbuffer = HCalloc (soundSource[source].sbuf_size);
} }
for (i = 0; i < sample->num_buffers; ++i) for (i = 0; i < sample->num_buffers; ++i)
@@ -616,7 +616,13 @@ GraphForegroundStream (uint8 *data, sint32 width, sint32 height)
} }
decoder = source->sample->decoder; decoder = source->sample->decoder;
assert (audio_GetFormatInfo (decoder->format, &channels, &sample_size)); if (!audio_GetFormatInfo (decoder->format, &channels, &sample_size))
{
UnlockMutex (source->stream_mutex);
log_add (log_Debug, "GraphForegroundStream(): uknown format %u",
(unsigned)decoder->format);
return 0;
}
full_sample = channels * sample_size; full_sample = channels * sample_size;
// See how far into the buffer we should be now // See how far into the buffer we should be now