+ if (pa_stream_is_corked(__mpStream)) {
+ AUDIO_IO_LOGW("stream is corked...do uncork here first!!!!");
+ pa_operation_unref(pa_stream_cork(__mpStream, 0, NULL, this));
+ }
+
+ if (__mIsFirstStream) {
+ const pa_buffer_attr* attr = pa_stream_get_buffer_attr(__mpStream);
+ uint32_t prebuf = attr->prebuf;
+ // Compensate amount of prebuf in first stream callback when audio-io use prebuf(-1)
+ // Because a stream will never start when an application wrote less than prebuf at first
+ if (length < prebuf) {
+ char* dummy = new char[prebuf - length];
+ memset(dummy, 0, prebuf - length);
+ pa_stream_write(__mpStream, dummy, prebuf - length, NULL, 0LL, PA_SEEK_RELATIVE);
+ delete [] dummy;
+ }
+ __mIsFirstStream = false;
+ AUDIO_IO_LOGW("FIRST STREAM CALLBACK : length[%zu], prebuf[%d], dummy[%zu]",
+ length, prebuf, (length < prebuf) ? prebuf - length : 0);
+ }