forked from xbmc/xbmc
/
DVDAudioCodecAndroidMediaCodec.cpp
583 lines (494 loc) · 17.7 KB
/
DVDAudioCodecAndroidMediaCodec.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
/*
* Copyright (C) 2016 Christian Browet
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
// http://developer.android.com/reference/android/media/MediaCodec.html
//
// Android MediaCodec class can be used to access low-level media codec,
// i.e. encoder/decoder components. (android.media.MediaCodec). Requires
// SDK16+ which is 4.1 Jellybean and above.
//
#include "DVDAudioCodecAndroidMediaCodec.h"
#include "DVDCodecs/DVDCodecs.h"
#include "DVDCodecs/DVDFactoryCodec.h"
#include "utils/log.h"
#include "settings/AdvancedSettings.h"
#include "cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h"
#include <androidjni/ByteBuffer.h>
#include <androidjni/MediaCodec.h>
#include <androidjni/MediaCrypto.h>
#include <androidjni/MediaFormat.h>
#include <androidjni/MediaCodecList.h>
#include <androidjni/MediaCodecInfo.h>
#include <androidjni/MediaCodecCryptoInfo.h>
#include "platform/android/activity/AndroidFeatures.h"
#include <androidjni/UUID.h>
#include <androidjni/Surface.h>
#include "utils/StringUtils.h"
#include <cassert>
static const AEChannel KnownChannels[] = { AE_CH_FL, AE_CH_FR, AE_CH_FC, AE_CH_LFE, AE_CH_SL, AE_CH_SR, AE_CH_BL, AE_CH_BR, AE_CH_BC, AE_CH_BLOC, AE_CH_BROC, AE_CH_NULL };
/****************************/
CDVDAudioCodecAndroidMediaCodec::CDVDAudioCodecAndroidMediaCodec(CProcessInfo &processInfo) :
CDVDAudioCodec(processInfo),
m_formatname("mediacodec"),
m_opened(false),
m_samplerate(0),
m_channels(0),
m_buffer(NULL),
m_bufferSize(0),
m_bufferUsed(0),
m_currentPts(DVD_NOPTS_VALUE),
m_crypto(0)
{
}
CDVDAudioCodecAndroidMediaCodec::~CDVDAudioCodecAndroidMediaCodec()
{
Dispose();
}
CDVDAudioCodec* CDVDAudioCodecAndroidMediaCodec::Create(CProcessInfo &processInfo)
{
return new CDVDAudioCodecAndroidMediaCodec(processInfo);
}
bool CDVDAudioCodecAndroidMediaCodec::Register()
{
CDVDFactoryCodec::RegisterHWAudioCodec("mediacodec_dec", &CDVDAudioCodecAndroidMediaCodec::Create);
return true;
}
bool CDVDAudioCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
{
if (!hints.cryptoSession)
return false;
m_hints = hints;
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec::Open codec(%d), profile(%d), tag(%d), extrasize(%d)", hints.codec, hints.profile, hints.codec_tag, hints.extrasize);
switch(m_hints.codec)
{
case AV_CODEC_ID_AAC:
case AV_CODEC_ID_AAC_LATM:
m_mime = "audio/mp4a-latm";
m_formatname = "amc-aac";
break;
case AV_CODEC_ID_MP2:
m_mime = "audio/mpeg-L2";
m_formatname = "amc-mp2";
break;
case AV_CODEC_ID_MP3:
m_mime = "audio/mpeg";
m_formatname = "amc-mp3";
break;
case AV_CODEC_ID_VORBIS:
m_mime = "audio/vorbis";
m_formatname = "amc-ogg";
//TODO
return false;
break;
case AV_CODEC_ID_WMAPRO:
m_mime = "audio/wmapro";
m_formatname = "amc-wma";
//TODO
return false;
break;
case AV_CODEC_ID_WMAV1:
case AV_CODEC_ID_WMAV2:
m_mime = "audio/x-ms-wma";
m_formatname = "amc-wma";
//TODO
return false;
break;
case AV_CODEC_ID_AC3:
m_mime = "audio/ac3";
m_formatname = "amc-ac3";
break;
case AV_CODEC_ID_EAC3:
m_mime = "audio/eac3";
m_formatname = "amc-eac3";
break;
default:
CLog::Log(LOGNOTICE, "CDVDAudioCodecAndroidMediaCodec:: Unknown hints.codec(%d)", hints.codec);
return false;
break;
}
if (m_crypto)
delete m_crypto;
if (m_hints.cryptoSession)
{
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec::Open Initializing MediaCrypto");
CJNIUUID uuid(jni::jhobject(NULL));
if (m_hints.cryptoSession->keySystem == CRYPTO_SESSION_SYSTEM_WIDEVINE)
uuid = CJNIUUID(0xEDEF8BA979D64ACEULL, 0xA3C827DCD51D21EDULL);
else if (m_hints.cryptoSession->keySystem == CRYPTO_SESSION_SYSTEM_PLAYREADY)
uuid = CJNIUUID(0x9A04F07998404286ULL, 0xAB92E65BE0885F95ULL);
else
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::Open Unsupported crypto-keysystem:%u", m_hints.cryptoSession->keySystem);
return false;
}
m_crypto = new CJNIMediaCrypto(uuid, std::vector<char>(m_hints.cryptoSession->sessionId, m_hints.cryptoSession->sessionId + m_hints.cryptoSession->sessionIdSize));
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "MediaCrypto::ExceptionCheck: <init>");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
return false;
}
}
else
m_crypto = new CJNIMediaCrypto(jni::jhobject(NULL));
m_codec = std::shared_ptr<CJNIMediaCodec>(new CJNIMediaCodec(CJNIMediaCodec::createDecoderByType(m_mime)));
if (xbmc_jnienv()->ExceptionCheck())
{
// Unsupported type?
xbmc_jnienv()->ExceptionClear();
m_codec = NULL;
}
if (!m_codec)
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec:: Failed to create Android MediaCodec");
return false;
}
if (!ConfigureMediaCodec())
{
m_codec.reset();
return false;
}
CLog::Log(LOGINFO, "CDVDAudioCodecAndroidMediaCodec:: Open Android MediaCodec %s", m_formatname.c_str());
m_opened = true;
m_processInfo.SetAudioDecoderName(m_formatname.c_str());
m_currentPts = DVD_NOPTS_VALUE;
return m_opened;
}
void CDVDAudioCodecAndroidMediaCodec::Dispose()
{
if (!m_opened)
return;
m_opened = false;
if (m_codec)
{
m_codec->stop();
m_codec->release();
m_codec.reset();
if (xbmc_jnienv()->ExceptionCheck())
xbmc_jnienv()->ExceptionClear();
}
if (m_crypto)
{
delete m_crypto;
m_crypto = nullptr;
}
}
bool CDVDAudioCodecAndroidMediaCodec::AddData(const DemuxPacket &packet)
{
if (g_advancedSettings.CanLogComponent(LOGAUDIO))
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec::AddData dts:%0.4lf pts:%0.4lf size(%d)", packet.dts, packet.pts, packet.iSize);
if (packet.pData)
{
// try to fetch an input buffer
int64_t timeout_us = 5000;
int index = m_codec->dequeueInputBuffer(timeout_us);
if (xbmc_jnienv()->ExceptionCheck())
{
std::string err = CJNIBase::ExceptionToString();
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::AddData ExceptionCheck \n %s", err.c_str());
}
else if (index >= 0)
{
CJNIByteBuffer buffer = m_codec->getInputBuffer(index);
int size = buffer.capacity();
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDMediaCodecInfo::AddData getInputBuffers ExceptionCheck");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
}
if (packet.iSize > size)
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::AddData, iSize(%d) > size(%d)", packet.iSize, size);
return packet.iSize;
}
// fetch a pointer to the ByteBuffer backing store
uint8_t *dst_ptr = (uint8_t*)xbmc_jnienv()->GetDirectBufferAddress(buffer.get_raw());
if (dst_ptr)
{
// Codec specifics
switch(m_hints.codec)
{
default:
memcpy(dst_ptr, packet.pData, packet.iSize);
break;
}
}
else
return false;
CJNIMediaCodecCryptoInfo *cryptoInfo(0);
if (!!m_crypto->get_raw() && packet.cryptoInfo)
{
cryptoInfo = new CJNIMediaCodecCryptoInfo();
cryptoInfo->set(
packet.cryptoInfo->numSubSamples,
std::vector<int>(packet.cryptoInfo->clearBytes, packet.cryptoInfo->clearBytes + packet.cryptoInfo->numSubSamples),
std::vector<int>(packet.cryptoInfo->cipherBytes, packet.cryptoInfo->cipherBytes + packet.cryptoInfo->numSubSamples),
std::vector<char>(packet.cryptoInfo->kid, packet.cryptoInfo->kid + 16),
std::vector<char>(packet.cryptoInfo->iv, packet.cryptoInfo->iv + 16),
CJNIMediaCodec::CRYPTO_MODE_AES_CTR);
}
int flags = 0;
int offset = 0;
int64_t presentationTimeUs = static_cast<int64_t>(packet.pts);
if (!cryptoInfo)
m_codec->queueInputBuffer(index, offset, packet.iSize, presentationTimeUs, flags);
else
{
m_codec->queueSecureInputBuffer(index, offset, *cryptoInfo, presentationTimeUs, flags);
delete cryptoInfo;
}
// clear any jni exceptions, jni gets upset if we do not.
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::Decode ExceptionCheck");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
}
}
}
m_format.m_dataFormat = GetDataFormat();
m_format.m_channelLayout = GetChannelMap();
m_format.m_sampleRate = GetSampleRate();
m_format.m_frameSize = m_format.m_channelLayout.Count() * CAEUtil::DataFormatToBits(m_format.m_dataFormat) >> 3;
return true;
}
void CDVDAudioCodecAndroidMediaCodec::Reset()
{
if (!m_opened)
return;
if (m_codec)
{
// now we can flush the actual MediaCodec object
m_codec->flush();
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::Reset ExceptionCheck");
xbmc_jnienv()->ExceptionClear();
}
}
m_currentPts = DVD_NOPTS_VALUE;
}
CAEChannelInfo CDVDAudioCodecAndroidMediaCodec::GetChannelMap()
{
CAEChannelInfo chaninfo;
for (int i=0; i<m_channels; ++i)
chaninfo += KnownChannels[i];
return chaninfo;
}
bool CDVDAudioCodecAndroidMediaCodec::ConfigureMediaCodec(void)
{
// setup a MediaFormat to match the audio content,
// used by codec during configure
CJNIMediaFormat mediaformat = CJNIMediaFormat::createAudioFormat(
m_mime.c_str(), m_hints.samplerate, m_hints.channels);
// handle codec extradata
if (m_hints.extrasize)
{
size_t size = m_hints.extrasize;
void *src_ptr = m_hints.extradata;
// Allocate a byte buffer via allocateDirect in java instead of NewDirectByteBuffer,
// since the latter doesn't allocate storage of its own, and we don't know how long
// the codec uses the buffer.
CJNIByteBuffer bytebuffer = CJNIByteBuffer::allocateDirect(size);
void *dts_ptr = xbmc_jnienv()->GetDirectBufferAddress(bytebuffer.get_raw());
memcpy(dts_ptr, src_ptr, size);
// codec will automatically handle buffers as extradata
// using entries with keys "csd-0", "csd-1", etc.
mediaformat.setByteBuffer("csd-0", bytebuffer);
}
else if (m_hints.codec == AV_CODEC_ID_AAC || m_hints.codec == AV_CODEC_ID_AAC_LATM)
{
mediaformat.setInteger(CJNIMediaFormat::KEY_IS_ADTS, 1);
}
// configure and start the codec.
// use the MediaFormat that we have setup.
// use a null MediaCrypto, our content is not encrypted.
// use a null Surface
int flags = 0;
CJNISurface surface(jni::jhobject(NULL));
m_codec->configure(mediaformat, surface, *m_crypto, flags);
// always, check/clear jni exceptions.
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::ExceptionCheck: configure");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
return false;
}
m_codec->start();
// always, check/clear jni exceptions.
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::ExceptionCheck: start");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
return false;
}
// There is no guarantee we'll get an INFO_OUTPUT_FORMAT_CHANGED (up to Android 4.3)
// Configure the output with defaults
ConfigureOutputFormat(&mediaformat);
return true;
}
void CDVDAudioCodecAndroidMediaCodec::GetData(DVDAudioFrame &frame)
{
frame.passthrough = false;
frame.nb_frames = 0;
frame.framesOut = 0;
frame.format.m_dataFormat = m_format.m_dataFormat;
frame.format.m_channelLayout = m_format.m_channelLayout;
frame.framesize = (CAEUtil::DataFormatToBits(frame.format.m_dataFormat) >> 3) * frame.format.m_channelLayout.Count();
if(frame.framesize == 0)
return;
frame.nb_frames = GetData(frame.data)/frame.framesize;
frame.planes = AE_IS_PLANAR(frame.format.m_dataFormat) ? frame.format.m_channelLayout.Count() : 1;
frame.bits_per_sample = CAEUtil::DataFormatToBits(frame.format.m_dataFormat);
frame.format.m_sampleRate = m_format.m_sampleRate;
frame.pts = m_currentPts;
m_currentPts = DVD_NOPTS_VALUE;
frame.matrix_encoding = GetMatrixEncoding();
frame.audio_service_type = GetAudioServiceType();
frame.profile = GetProfile();
// compute duration.
if (frame.format.m_sampleRate)
frame.duration = ((double)frame.nb_frames * DVD_TIME_BASE) / frame.format.m_sampleRate;
else
frame.duration = 0.0;
if (frame.nb_frames > 0 && g_advancedSettings.CanLogComponent(LOGAUDIO))
CLog::Log(LOGERROR, "MediaCodecAudio::GetData: frames:%d pts: %0.4f", frame.nb_frames, frame.pts);
}
int CDVDAudioCodecAndroidMediaCodec::GetData(uint8_t** dst)
{
m_bufferUsed = 0;
int64_t timeout_us = 10000;
CJNIMediaCodecBufferInfo bufferInfo;
int index = m_codec->dequeueOutputBuffer(bufferInfo, timeout_us);
if (xbmc_jnienv()->ExceptionCheck())
{
std::string err = CJNIBase::ExceptionToString();
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::GetData ExceptionCheck; dequeueOutputBuffer \n %s", err.c_str());
return 0;
}
if (index >= 0)
{
CJNIByteBuffer buffer = m_codec->getOutputBuffer(index);
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::GetData ExceptionCheck: getOutputBuffer(%d)", index);
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
return 0;
}
int flags = bufferInfo.flags();
if (flags & CJNIMediaCodec::BUFFER_FLAG_SYNC_FRAME)
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec:: BUFFER_FLAG_SYNC_FRAME");
if (flags & CJNIMediaCodec::BUFFER_FLAG_CODEC_CONFIG)
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec:: BUFFER_FLAG_CODEC_CONFIG");
if (flags & CJNIMediaCodec::BUFFER_FLAG_END_OF_STREAM)
{
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec:: BUFFER_FLAG_END_OF_STREAM");
m_codec->releaseOutputBuffer(index, false);
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::GetData ExceptionCheck: releaseOutputBuffer");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
return 0;
}
return 0;
}
int size = bufferInfo.size();
int offset = bufferInfo.offset();
if (!buffer.isDirect())
CLog::Log(LOGWARNING, "CDVDAudioCodecAndroidMediaCodec:: buffer.isDirect == false");
if (size && buffer.capacity())
{
uint8_t *src_ptr = (uint8_t*)xbmc_jnienv()->GetDirectBufferAddress(buffer.get_raw());
src_ptr += offset;
if (size > m_bufferSize)
{
m_bufferSize = size;
m_buffer = (uint8_t*)realloc(m_buffer, m_bufferSize);
}
memcpy(m_buffer, src_ptr, size);
m_bufferUsed = size;
}
else
return 0;
m_codec->releaseOutputBuffer(index, false);
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::GetData ExceptionCheck: releaseOutputBuffer");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
}
if (g_advancedSettings.CanLogComponent(LOGAUDIO))
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec::GetData index(%d), size(%d)", index, m_bufferUsed);
m_currentPts = bufferInfo.presentationTimeUs() == (int64_t)DVD_NOPTS_VALUE ? DVD_NOPTS_VALUE : bufferInfo.presentationTimeUs();
// always, check/clear jni exceptions.
if (xbmc_jnienv()->ExceptionCheck())
xbmc_jnienv()->ExceptionClear();
}
else if (index == CJNIMediaCodec::INFO_OUTPUT_BUFFERS_CHANGED)
{
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec:: GetData OUTPUT_BUFFERS_CHANGED");
}
else if (index == CJNIMediaCodec::INFO_OUTPUT_FORMAT_CHANGED)
{
CJNIMediaFormat mediaformat = m_codec->getOutputFormat();
if (xbmc_jnienv()->ExceptionCheck())
{
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::GetData(INFO_OUTPUT_FORMAT_CHANGED) ExceptionCheck: getOutputBuffers");
xbmc_jnienv()->ExceptionDescribe();
xbmc_jnienv()->ExceptionClear();
}
ConfigureOutputFormat(&mediaformat);
}
else if (index == CJNIMediaCodec::INFO_TRY_AGAIN_LATER)
{
// normal dequeueOutputBuffer timeout, ignore it.
m_bufferUsed = 0;
}
else
{
// we should never get here
CLog::Log(LOGERROR, "CDVDAudioCodecAndroidMediaCodec::GetData unknown index(%d)", index);
}
*dst = m_buffer;
return m_bufferUsed;
}
void CDVDAudioCodecAndroidMediaCodec::ConfigureOutputFormat(CJNIMediaFormat* mediaformat)
{
m_samplerate = 0;
m_channels = 0;
if (mediaformat->containsKey("sample-rate"))
m_samplerate = mediaformat->getInteger("sample-rate");
if (mediaformat->containsKey("channel-count"))
m_channels = mediaformat->getInteger("channel-count");
#if 1 //defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "CDVDAudioCodecAndroidMediaCodec:: "
"sample_rate(%d), channel_count(%d)",
m_samplerate, m_channels);
#endif
// clear any jni exceptions
if (xbmc_jnienv()->ExceptionCheck())
xbmc_jnienv()->ExceptionClear();
}