LCOV - code coverage report
Current view: top level - media/libstagefright/frameworks/av/media/libstagefright/foundation - ABuffer.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2010 The Android Open Source Project
       3             :  *
       4             :  * Licensed under the Apache License, Version 2.0 (the "License");
       5             :  * you may not use this file except in compliance with the License.
       6             :  * You may obtain a copy of the License at
       7             :  *
       8             :  *      http://www.apache.org/licenses/LICENSE-2.0
       9             :  *
      10             :  * Unless required by applicable law or agreed to in writing, software
      11             :  * distributed under the License is distributed on an "AS IS" BASIS,
      12             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13             :  * See the License for the specific language governing permissions and
      14             :  * limitations under the License.
      15             :  */
      16             : 
      17             : #include "ABuffer.h"
      18             : 
      19             : #include "ADebug.h"
      20             : #include "ALooper.h"
      21             : #include "AMessage.h"
      22             : 
      23             : namespace stagefright {
      24             : 
      25           0 : ABuffer::ABuffer(size_t capacity)
      26           0 :     : mData(malloc(capacity)),
      27             :       mCapacity(capacity),
      28             :       mRangeOffset(0),
      29             :       mRangeLength(capacity),
      30             :       mInt32Data(0),
      31           0 :       mOwnsData(true) {
      32           0 : }
      33             : 
      34           0 : ABuffer::ABuffer(void *data, size_t capacity)
      35             :     : mData(data),
      36             :       mCapacity(capacity),
      37             :       mRangeOffset(0),
      38             :       mRangeLength(capacity),
      39             :       mInt32Data(0),
      40           0 :       mOwnsData(false) {
      41           0 : }
      42             : 
      43           0 : ABuffer::~ABuffer() {
      44           0 :     if (mOwnsData) {
      45           0 :         if (mData != NULL) {
      46           0 :             free(mData);
      47           0 :             mData = NULL;
      48             :         }
      49             :     }
      50             : 
      51           0 :     if (mFarewell != NULL) {
      52           0 :         mFarewell->post();
      53             :     }
      54           0 : }
      55             : 
      56           0 : void ABuffer::setRange(size_t offset, size_t size) {
      57           0 :     CHECK_LE(offset, mCapacity);
      58           0 :     CHECK_LE(offset + size, mCapacity);
      59             : 
      60           0 :     mRangeOffset = offset;
      61           0 :     mRangeLength = size;
      62           0 : }
      63             : 
      64           0 : void ABuffer::setFarewellMessage(const sp<AMessage> msg) {
      65           0 :     mFarewell = msg;
      66           0 : }
      67             : 
      68           0 : sp<AMessage> ABuffer::meta() {
      69           0 :     if (mMeta == NULL) {
      70           0 :         mMeta = new AMessage;
      71             :     }
      72           0 :     return mMeta;
      73             : }
      74             : 
      75             : }  // namespace stagefright
      76             : 

Generated by: LCOV version 1.13