@@ -152,7 +152,7 @@ TEST(VideoDecoderTest, RespectsWidthAndHeightFromOptions) {
152
152
streamOptions.width = 100 ;
153
153
streamOptions.height = 120 ;
154
154
decoder->addVideoStreamDecoder (-1 , streamOptions);
155
- torch::Tensor tensor = decoder->getNextDecodedOutputNoDemux ().frame ;
155
+ torch::Tensor tensor = decoder->getNextDecodedOutput ().frame ;
156
156
EXPECT_EQ (tensor.sizes (), std::vector<long >({3 , 120 , 100 }));
157
157
}
158
158
@@ -163,7 +163,7 @@ TEST(VideoDecoderTest, RespectsOutputTensorDimensionOrderFromOptions) {
163
163
VideoDecoder::VideoStreamDecoderOptions streamOptions;
164
164
streamOptions.dimensionOrder = " NHWC" ;
165
165
decoder->addVideoStreamDecoder (-1 , streamOptions);
166
- torch::Tensor tensor = decoder->getNextDecodedOutputNoDemux ().frame ;
166
+ torch::Tensor tensor = decoder->getNextDecodedOutput ().frame ;
167
167
EXPECT_EQ (tensor.sizes (), std::vector<long >({270 , 480 , 3 }));
168
168
}
169
169
@@ -172,12 +172,12 @@ TEST_P(VideoDecoderTest, ReturnsFirstTwoFramesOfVideo) {
172
172
std::unique_ptr<VideoDecoder> ourDecoder =
173
173
createDecoderFromPath (path, GetParam ());
174
174
ourDecoder->addVideoStreamDecoder (-1 );
175
- auto output = ourDecoder->getNextDecodedOutputNoDemux ();
175
+ auto output = ourDecoder->getNextDecodedOutput ();
176
176
torch::Tensor tensor0FromOurDecoder = output.frame ;
177
177
EXPECT_EQ (tensor0FromOurDecoder.sizes (), std::vector<long >({3 , 270 , 480 }));
178
178
EXPECT_EQ (output.ptsSeconds , 0.0 );
179
179
EXPECT_EQ (output.pts , 0 );
180
- output = ourDecoder->getNextDecodedOutputNoDemux ();
180
+ output = ourDecoder->getNextDecodedOutput ();
181
181
torch::Tensor tensor1FromOurDecoder = output.frame ;
182
182
EXPECT_EQ (tensor1FromOurDecoder.sizes (), std::vector<long >({3 , 270 , 480 }));
183
183
EXPECT_EQ (output.ptsSeconds , 1'001 . / 30'000 );
@@ -219,12 +219,12 @@ TEST(GPUVideoDecoderTest, ReturnsFirstTwoFramesOfVideo) {
219
219
ASSERT_TRUE (streamOptions.device .is_cuda ());
220
220
ASSERT_EQ (streamOptions.device .type (), torch::DeviceType::CUDA);
221
221
ourDecoder->addVideoStreamDecoder (-1 , streamOptions);
222
- auto output = ourDecoder->getNextDecodedOutputNoDemux ();
222
+ auto output = ourDecoder->getNextDecodedOutput ();
223
223
torch::Tensor tensor1FromOurDecoder = output.frame ;
224
224
EXPECT_EQ (tensor1FromOurDecoder.sizes (), std::vector<long >({3 , 270 , 480 }));
225
225
EXPECT_EQ (output.ptsSeconds , 0.0 );
226
226
EXPECT_EQ (output.pts , 0 );
227
- output = ourDecoder->getNextDecodedOutputNoDemux ();
227
+ output = ourDecoder->getNextDecodedOutput ();
228
228
torch::Tensor tensor2FromOurDecoder = output.frame ;
229
229
EXPECT_EQ (tensor2FromOurDecoder.sizes (), std::vector<long >({3 , 270 , 480 }));
230
230
EXPECT_EQ (output.ptsSeconds , 1'001 . / 30'000 );
@@ -306,31 +306,30 @@ TEST_P(VideoDecoderTest, SeeksCloseToEof) {
306
306
createDecoderFromPath (path, GetParam ());
307
307
ourDecoder->addVideoStreamDecoder (-1 );
308
308
ourDecoder->setCursorPtsInSeconds (388388 . / 30'000 );
309
- auto output = ourDecoder->getNextDecodedOutputNoDemux ();
309
+ auto output = ourDecoder->getNextDecodedOutput ();
310
310
EXPECT_EQ (output.ptsSeconds , 388'388 . / 30'000 );
311
- output = ourDecoder->getNextDecodedOutputNoDemux ();
311
+ output = ourDecoder->getNextDecodedOutput ();
312
312
EXPECT_EQ (output.ptsSeconds , 389'389 . / 30'000 );
313
- EXPECT_THROW (ourDecoder->getNextDecodedOutputNoDemux (), std::exception);
313
+ EXPECT_THROW (ourDecoder->getNextDecodedOutput (), std::exception);
314
314
}
315
315
316
316
TEST_P (VideoDecoderTest, GetsFrameDisplayedAtTimestamp) {
317
317
std::string path = getResourcePath (" nasa_13013.mp4" );
318
318
std::unique_ptr<VideoDecoder> ourDecoder =
319
319
createDecoderFromPath (path, GetParam ());
320
320
ourDecoder->addVideoStreamDecoder (-1 );
321
- auto output = ourDecoder->getFrameDisplayedAtTimestampNoDemux (6.006 );
321
+ auto output = ourDecoder->getFrameDisplayedAtTimestamp (6.006 );
322
322
EXPECT_EQ (output.ptsSeconds , 6.006 );
323
323
// The frame's duration is 0.033367 according to ffprobe,
324
324
// so the next frame is displayed at timestamp=6.039367.
325
325
const double kNextFramePts = 6.039366666666667 ;
326
326
// The frame that is displayed a microsecond before the next frame is still
327
327
// the previous frame.
328
- output =
329
- ourDecoder->getFrameDisplayedAtTimestampNoDemux (kNextFramePts - 1e-6 );
328
+ output = ourDecoder->getFrameDisplayedAtTimestamp (kNextFramePts - 1e-6 );
330
329
EXPECT_EQ (output.ptsSeconds , 6.006 );
331
330
// The frame that is displayed at the exact pts of the frame is the next
332
331
// frame.
333
- output = ourDecoder->getFrameDisplayedAtTimestampNoDemux (kNextFramePts );
332
+ output = ourDecoder->getFrameDisplayedAtTimestamp (kNextFramePts );
334
333
EXPECT_EQ (output.ptsSeconds , kNextFramePts );
335
334
336
335
// This is the timestamp of the last frame in this video.
@@ -340,7 +339,7 @@ TEST_P(VideoDecoderTest, GetsFrameDisplayedAtTimestamp) {
340
339
kPtsOfLastFrameInVideoStream + kDurationOfLastFrameInVideoStream ;
341
340
// Sanity check: make sure duration is strictly positive.
342
341
EXPECT_GT (kPtsPlusDurationOfLastFrame , kPtsOfLastFrameInVideoStream );
343
- output = ourDecoder->getFrameDisplayedAtTimestampNoDemux (
342
+ output = ourDecoder->getFrameDisplayedAtTimestamp (
344
343
kPtsPlusDurationOfLastFrame - 1e-6 );
345
344
EXPECT_EQ (output.ptsSeconds , kPtsOfLastFrameInVideoStream );
346
345
}
@@ -351,7 +350,7 @@ TEST_P(VideoDecoderTest, SeeksToFrameWithSpecificPts) {
351
350
createDecoderFromPath (path, GetParam ());
352
351
ourDecoder->addVideoStreamDecoder (-1 );
353
352
ourDecoder->setCursorPtsInSeconds (6.0 );
354
- auto output = ourDecoder->getNextDecodedOutputNoDemux ();
353
+ auto output = ourDecoder->getNextDecodedOutput ();
355
354
torch::Tensor tensor6FromOurDecoder = output.frame ;
356
355
EXPECT_EQ (output.ptsSeconds , 180'180 . / 30'000 );
357
356
torch::Tensor tensor6FromFFMPEG =
@@ -367,7 +366,7 @@ TEST_P(VideoDecoderTest, SeeksToFrameWithSpecificPts) {
367
366
EXPECT_GT (ourDecoder->getDecodeStats ().numPacketsSentToDecoder , 180 );
368
367
369
368
ourDecoder->setCursorPtsInSeconds (6.1 );
370
- output = ourDecoder->getNextDecodedOutputNoDemux ();
369
+ output = ourDecoder->getNextDecodedOutput ();
371
370
torch::Tensor tensor61FromOurDecoder = output.frame ;
372
371
EXPECT_EQ (output.ptsSeconds , 183'183 . / 30'000 );
373
372
torch::Tensor tensor61FromFFMPEG =
@@ -387,7 +386,7 @@ TEST_P(VideoDecoderTest, SeeksToFrameWithSpecificPts) {
387
386
EXPECT_LT (ourDecoder->getDecodeStats ().numPacketsSentToDecoder , 10 );
388
387
389
388
ourDecoder->setCursorPtsInSeconds (10.0 );
390
- output = ourDecoder->getNextDecodedOutputNoDemux ();
389
+ output = ourDecoder->getNextDecodedOutput ();
391
390
torch::Tensor tensor10FromOurDecoder = output.frame ;
392
391
EXPECT_EQ (output.ptsSeconds , 300'300 . / 30'000 );
393
392
torch::Tensor tensor10FromFFMPEG =
@@ -404,7 +403,7 @@ TEST_P(VideoDecoderTest, SeeksToFrameWithSpecificPts) {
404
403
EXPECT_GT (ourDecoder->getDecodeStats ().numPacketsSentToDecoder , 60 );
405
404
406
405
ourDecoder->setCursorPtsInSeconds (6.0 );
407
- output = ourDecoder->getNextDecodedOutputNoDemux ();
406
+ output = ourDecoder->getNextDecodedOutput ();
408
407
tensor6FromOurDecoder = output.frame ;
409
408
EXPECT_EQ (output.ptsSeconds , 180'180 . / 30'000 );
410
409
EXPECT_TRUE (torch::equal (tensor6FromOurDecoder, tensor6FromFFMPEG));
@@ -419,7 +418,7 @@ TEST_P(VideoDecoderTest, SeeksToFrameWithSpecificPts) {
419
418
420
419
constexpr double kPtsOfLastFrameInVideoStream = 389'389 . / 30'000 ; // ~12.9
421
420
ourDecoder->setCursorPtsInSeconds (kPtsOfLastFrameInVideoStream );
422
- output = ourDecoder->getNextDecodedOutputNoDemux ();
421
+ output = ourDecoder->getNextDecodedOutput ();
423
422
torch::Tensor tensor7FromOurDecoder = output.frame ;
424
423
EXPECT_EQ (output.ptsSeconds , 389'389 . / 30'000 );
425
424
torch::Tensor tensor7FromFFMPEG =
0 commit comments