Home | History | Annotate | Download | only in audioflinger
      1 /*
      2 **
      3 ** Copyright 2012, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 #ifndef INCLUDING_FROM_AUDIOFLINGER_H
     19     #error This header file should only be included from AudioFlinger.h
     20 #endif
     21 
     22 // record track
     23 class RecordTrack : public TrackBase {
     24 public:
     25                         RecordTrack(RecordThread *thread,
     26                                 const sp<Client>& client,
     27                                 uint32_t sampleRate,
     28                                 audio_format_t format,
     29                                 audio_channel_mask_t channelMask,
     30                                 size_t frameCount,
     31                                 int sessionId);
     32     virtual             ~RecordTrack();
     33 
     34     virtual status_t    start(AudioSystem::sync_event_t event, int triggerSession);
     35     virtual void        stop();
     36 
     37             void        destroy();
     38 
     39             void        invalidate();
     40             // clear the buffer overflow flag
     41             void        clearOverflow() { mOverflow = false; }
     42             // set the buffer overflow flag and return previous value
     43             bool        setOverflow() { bool tmp = mOverflow; mOverflow = true;
     44                                                 return tmp; }
     45 
     46     static  void        appendDumpHeader(String8& result);
     47             void        dump(char* buffer, size_t size);
     48 
     49 private:
     50     friend class AudioFlinger;  // for mState
     51 
     52                         RecordTrack(const RecordTrack&);
     53                         RecordTrack& operator = (const RecordTrack&);
     54 
     55     // AudioBufferProvider interface
     56     virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer,
     57                                    int64_t pts = kInvalidPTS);
     58     // releaseBuffer() not overridden
     59 
     60     bool                mOverflow;  // overflow on most recent attempt to fill client buffer
     61     AudioRecordServerProxy* mAudioRecordServerProxy;
     62 };
     63