Add an E2E test for changing sample rate with AudioProcessor.
PiperOrigin-RevId: 492160193
This commit is contained in:
parent
0993479efe
commit
e5727a2cc7
@ -0,0 +1,473 @@
|
||||
format 0:
|
||||
sampleMimeType = audio/mp4a-latm
|
||||
channelCount = 1
|
||||
sampleRate = 48000
|
||||
pcmEncoding = 2
|
||||
format 1:
|
||||
id = 1
|
||||
sampleMimeType = video/avc
|
||||
codecs = avc1.64001F
|
||||
maxInputSize = 36722
|
||||
width = 1080
|
||||
height = 720
|
||||
frameRate = 29.970028
|
||||
initializationData:
|
||||
data = length 29, hash 4746B5D9
|
||||
data = length 10, hash 7A0D0F2B
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -770308242
|
||||
size = 36692
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 0
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -732087136
|
||||
size = 5312
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 66733
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 468156717
|
||||
size = 599
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 33366
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1150349584
|
||||
size = 7735
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 200200
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1443582006
|
||||
size = 987
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 133466
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -310585145
|
||||
size = 673
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 100100
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 807460688
|
||||
size = 523
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 166833
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1936487090
|
||||
size = 6061
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 333666
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -32297181
|
||||
size = 992
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 266933
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1529616406
|
||||
size = 623
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 233566
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1949198785
|
||||
size = 421
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 300300
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -147880287
|
||||
size = 4899
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 433766
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1369083472
|
||||
size = 568
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 400400
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 965782073
|
||||
size = 620
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 367033
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -261176150
|
||||
size = 5450
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 567233
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 1868041800
|
||||
size = 22
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 0
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 1552866193
|
||||
size = 8
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 230
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 701848493
|
||||
size = 160
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 313
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 2000505720
|
||||
size = 206
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 1980
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 57276327
|
||||
size = 222
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 4125
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 382237408
|
||||
size = 228
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 6438
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 795308374
|
||||
size = 228
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 8813
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 356270426
|
||||
size = 224
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 11188
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 963641614
|
||||
size = 244
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 13521
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 2045272193
|
||||
size = 234
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 16063
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -251933090
|
||||
size = 228
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 18500
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -329315280
|
||||
size = 234
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 20875
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1536715689
|
||||
size = 248
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 23313
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1275249610
|
||||
size = 254
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 25896
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -2081231470
|
||||
size = 254
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 28542
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 1912348529
|
||||
size = 250
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 31188
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1393642278
|
||||
size = 246
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 33792
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -2073671562
|
||||
size = 236
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 36355
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -381095129
|
||||
size = 248
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 38813
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -804721381
|
||||
size = 238
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 41396
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 172275944
|
||||
size = 260
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 43875
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1045486664
|
||||
size = 248
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 46584
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1465283679
|
||||
size = 260
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 49167
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 1840117006
|
||||
size = 254
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 51875
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -631848848
|
||||
size = 250
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 54521
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1207491554
|
||||
size = 236
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 57125
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 838792456
|
||||
size = 258
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 59584
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1131122284
|
||||
size = 264
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 62271
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -122326555
|
||||
size = 250
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 65021
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1340323720
|
||||
size = 250
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 67625
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1290952882
|
||||
size = 260
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 70230
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 2118216858
|
||||
size = 244
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 72938
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 879520231
|
||||
size = 252
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 75480
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -174892555
|
||||
size = 264
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 78105
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -555873771
|
||||
size = 252
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 80855
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1479853263
|
||||
size = 256
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 83480
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1068971504
|
||||
size = 250
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 86146
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -866214350
|
||||
size = 254
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 88750
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -2111034853
|
||||
size = 288
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 91396
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1445430754
|
||||
size = 278
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 94396
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = 1200468541
|
||||
size = 246
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 97292
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1853596884
|
||||
size = 246
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 99855
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1266372568
|
||||
size = 254
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 102417
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -212017561
|
||||
size = 248
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 105063
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -1464702479
|
||||
size = 8
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 107646
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -1830836678
|
||||
size = 1051
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 500500
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1767407540
|
||||
size = 874
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 467133
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 918440283
|
||||
size = 781
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 533866
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -1408463661
|
||||
size = 4725
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 700700
|
||||
sample:
|
||||
trackIndex = 0
|
||||
dataHashCode = -2065
|
||||
size = 2
|
||||
isKeyFrame = true
|
||||
presentationTimeUs = 107730
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1569455924
|
||||
size = 1022
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 633966
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -1723778407
|
||||
size = 790
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 600600
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1578275472
|
||||
size = 610
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 667333
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1989768395
|
||||
size = 2751
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 834166
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -1215674502
|
||||
size = 745
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 767433
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -814473606
|
||||
size = 621
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 734066
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 498370894
|
||||
size = 505
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 800800
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -1051506468
|
||||
size = 1268
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 967633
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -1025604144
|
||||
size = 880
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 900900
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = -913586520
|
||||
size = 530
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 867533
|
||||
sample:
|
||||
trackIndex = 1
|
||||
dataHashCode = 1340459242
|
||||
size = 568
|
||||
isKeyFrame = false
|
||||
presentationTimeUs = 934266
|
||||
released = true
|
@ -43,6 +43,7 @@ import androidx.media3.common.C;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.exoplayer.audio.SonicAudioProcessor;
|
||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory;
|
||||
import androidx.media3.exoplayer.source.MediaSource;
|
||||
import androidx.media3.extractor.DefaultExtractorsFactory;
|
||||
@ -280,6 +281,23 @@ public final class TransformerEndToEndTest {
|
||||
context, testMuxer, getDumpFileName(FILE_AUDIO_VIDEO + ".silentaudio"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startTransformation_adjustSampleRate_completesSuccessfully() throws Exception {
|
||||
SonicAudioProcessor sonicAudioProcessor = new SonicAudioProcessor();
|
||||
sonicAudioProcessor.setOutputSampleRateHz(48000);
|
||||
Transformer transformer =
|
||||
createTransformerBuilder(/* enableFallback= */ false)
|
||||
.setAudioProcessors(ImmutableList.of(sonicAudioProcessor))
|
||||
.build();
|
||||
MediaItem mediaItem = MediaItem.fromUri(ASSET_URI_PREFIX + FILE_AUDIO_VIDEO);
|
||||
|
||||
transformer.startTransformation(mediaItem, outputPath);
|
||||
TransformerTestRunner.runUntilCompleted(transformer);
|
||||
|
||||
DumpFileAsserts.assertOutput(
|
||||
context, testMuxer, getDumpFileName(FILE_AUDIO_VIDEO + ".48000hz"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startTransformation_withMultipleListeners_callsEachOnCompletion() throws Exception {
|
||||
Transformer.Listener mockListener1 = mock(Transformer.Listener.class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user