Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9875

Bug in QAudioOutput: Invalid use of "waveOutUnprepareHeader"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 4.6.3
    • 4.6.2
    • Multimedia
    • None
    • Win XP

    Description

      I found a following code at src/multimedia/audio/qaudiooutput_win32_p.cpp:146

      void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray)
      	{
      	    WAVEHDR* blocks = blockArray;
      	
      	    int count = buffer_size/period_size;
      	
      	    for(int i = 0; i < count; i++) {
      	        waveOutUnprepareHeader(hWaveOut,&blocks[i], sizeof(WAVEHDR));
      	        blocks+=sizeof(WAVEHDR);
      	    }
                        HeapFree(GetProcessHeap(), 0, blockArray);
      	}
      

      I think it can't bee good. Especially the "&blocks[i]" part.
      This looks better:

       
      ...
      	    for(int i = 0; i < count; i++) {
      	        waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR));
      	        blocks+=sizeof(WAVEHDR);
      	    }
      ...
      

      or

      ...
      	    for(int i = 0; i < count; i++) {
      	        if(blocks->dwFlags & WHDR_PREPARED)
      	               waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR));
      	        blocks+=sizeof(WAVEHDR);
      	    }
      ...
      

      Like in QAudioOutputPrivate::write(...).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            korbatit Kurt Korbatits (closed Nokia identity) (Inactive)
            tr3w Tr3wory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes