| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 78 | 78 | 
| 79 int32_t AudioCoder::Encode(const AudioFrame& audio, | 79 int32_t AudioCoder::Encode(const AudioFrame& audio, | 
| 80                            int8_t* encodedData, | 80                            int8_t* encodedData, | 
| 81                            size_t& encodedLengthInBytes) | 81                            size_t& encodedLengthInBytes) | 
| 82 { | 82 { | 
| 83     // Fake a timestamp in case audio doesn't contain a correct timestamp. | 83     // Fake a timestamp in case audio doesn't contain a correct timestamp. | 
| 84     // Make a local copy of the audio frame since audio is const | 84     // Make a local copy of the audio frame since audio is const | 
| 85     AudioFrame audioFrame; | 85     AudioFrame audioFrame; | 
| 86     audioFrame.CopyFrom(audio); | 86     audioFrame.CopyFrom(audio); | 
| 87     audioFrame.timestamp_ = _encodeTimestamp; | 87     audioFrame.timestamp_ = _encodeTimestamp; | 
| 88     _encodeTimestamp += audioFrame.samples_per_channel_; | 88     _encodeTimestamp += static_cast<uint32_t>(audioFrame.samples_per_channel_); | 
| 89 | 89 | 
| 90     // For any codec with a frame size that is longer than 10 ms the encoded | 90     // For any codec with a frame size that is longer than 10 ms the encoded | 
| 91     // length in bytes should be zero until a a full frame has been encoded. | 91     // length in bytes should be zero until a a full frame has been encoded. | 
| 92     _encodedLengthInBytes = 0; | 92     _encodedLengthInBytes = 0; | 
| 93     if(_acm->Add10MsData((AudioFrame&)audioFrame) == -1) | 93     if(_acm->Add10MsData((AudioFrame&)audioFrame) == -1) | 
| 94     { | 94     { | 
| 95         return -1; | 95         return -1; | 
| 96     } | 96     } | 
| 97     _encodedData = encodedData; | 97     _encodedData = encodedData; | 
| 98     encodedLengthInBytes = _encodedLengthInBytes; | 98     encodedLengthInBytes = _encodedLengthInBytes; | 
| 99     return 0; | 99     return 0; | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 int32_t AudioCoder::SendData( | 102 int32_t AudioCoder::SendData( | 
| 103     FrameType /* frameType */, | 103     FrameType /* frameType */, | 
| 104     uint8_t   /* payloadType */, | 104     uint8_t   /* payloadType */, | 
| 105     uint32_t  /* timeStamp */, | 105     uint32_t  /* timeStamp */, | 
| 106     const uint8_t*  payloadData, | 106     const uint8_t*  payloadData, | 
| 107     size_t  payloadSize, | 107     size_t  payloadSize, | 
| 108     const RTPFragmentationHeader* /* fragmentation*/) | 108     const RTPFragmentationHeader* /* fragmentation*/) | 
| 109 { | 109 { | 
| 110     memcpy(_encodedData,payloadData,sizeof(uint8_t) * payloadSize); | 110     memcpy(_encodedData,payloadData,sizeof(uint8_t) * payloadSize); | 
| 111     _encodedLengthInBytes = payloadSize; | 111     _encodedLengthInBytes = payloadSize; | 
| 112     return 0; | 112     return 0; | 
| 113 } | 113 } | 
| 114 }  // namespace webrtc | 114 }  // namespace webrtc | 
| OLD | NEW | 
|---|