Skip to content

Commit 7972d65

Browse files
authored
Merge pull request #316 from avTranscoder/fix/java_binding
Fix: Java binding
2 parents 99dba44 + 9db1c51 commit 7972d65

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

src/AvTranscoder/stream/InputStream.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ void InputStream::addPacket(const AVPacket& packet)
122122
return;
123123
}
124124

125-
LOG_DEBUG("Add a packet data for the stream " << _streamIndex << " to the cache")
126-
_streamCache.push(CodedData());
127-
_streamCache.back().copyData(packet.data, packet.size);
125+
LOG_DEBUG("Add a packet data for the stream " << _streamIndex << " to the cache");
126+
CodedData codedData;
127+
codedData.copyData(packet.data, packet.size);
128+
_streamCache.push(codedData);
128129
}
129130

130131
void InputStream::clearBuffering()

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ StreamTranscoder::~StreamTranscoder()
540540
{
541541
for(std::vector<IFrame*>::iterator it = _decodedData.begin(); it != _decodedData.end(); ++it)
542542
{
543-
delete(*it);
543+
delete(*it);
544544
}
545545

546546
if(_filteredData != NULL && _filteredData->isDataAllocated())

test/pyTest/testCodedData.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from nose.tools import *
2+
3+
from pyAvTranscoder import avtranscoder as av
4+
5+
def testCodedDataConstructors():
6+
"""
7+
Try to create a CodedData instances from different constructors.
8+
"""
9+
dataSize = 1024
10+
codedData = av.CodedData(dataSize)
11+
assert_equals(dataSize, codedData.getSize())
12+
13+
codedDataCopy = av.CodedData(codedData)
14+
assert_equals(dataSize, codedDataCopy.getSize())
15+
16+
17+
def testCodedDataManagement():
18+
"""
19+
Try to resize and assign CodedData data.
20+
"""
21+
dataSize = 1024
22+
codedData = av.CodedData()
23+
codedData.resize(dataSize)
24+
assert_equals(dataSize, codedData.getSize())
25+
26+
newDataSize = 128
27+
codedData.assign(newDataSize, 1)
28+
assert_equals(newDataSize, codedData.getSize())
29+
data = codedData.getData()
30+
for i in range(0, newDataSize):
31+
assert_equals('\x01', data[i])
32+
33+
newDataSize = 256
34+
codedData.resize(newDataSize)
35+
assert_equals(newDataSize, codedData.getSize())

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy