Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: media/filters/ffmpeg_demuxer_unittest.cc

Issue 2549263002: FFmpegDemuxer should fall back to disabled streams for seeking (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 EXPECT_EQ(DemuxerStream::AUDIO, stream->type()); 1464 EXPECT_EQ(DemuxerStream::AUDIO, stream->type());
1465 1465
1466 const AudioDecoderConfig& audio_config = stream->audio_decoder_config(); 1466 const AudioDecoderConfig& audio_config = stream->audio_decoder_config();
1467 EXPECT_EQ(kCodecFLAC, audio_config.codec()); 1467 EXPECT_EQ(kCodecFLAC, audio_config.codec());
1468 EXPECT_EQ(32, audio_config.bits_per_channel()); 1468 EXPECT_EQ(32, audio_config.bits_per_channel());
1469 EXPECT_EQ(CHANNEL_LAYOUT_MONO, audio_config.channel_layout()); 1469 EXPECT_EQ(CHANNEL_LAYOUT_MONO, audio_config.channel_layout());
1470 EXPECT_EQ(44100, audio_config.samples_per_second()); 1470 EXPECT_EQ(44100, audio_config.samples_per_second());
1471 EXPECT_EQ(kSampleFormatS32, audio_config.sample_format()); 1471 EXPECT_EQ(kSampleFormatS32, audio_config.sample_format());
1472 } 1472 }
1473 1473
1474 // Verify that FFmpeg demuxer falls back to choosing disabled streams for
1475 // seeking if there's no suitable enabled stream found.
1476 TEST_F(FFmpegDemuxerTest, Seek_FallbackToDisabledVideoStream) {
1477 // Input has only video stream, no audio.
1478 CreateDemuxer("bear-320x240-video-only.webm");
1479 InitializeDemuxer();
1480 EXPECT_EQ(nullptr, demuxer_->GetStream(DemuxerStream::AUDIO));
1481 DemuxerStream* vstream = demuxer_->GetStream(DemuxerStream::VIDEO);
1482 EXPECT_NE(nullptr, vstream);
1483 EXPECT_EQ(vstream, preferred_seeking_stream(base::TimeDelta()));
1484
1485 // Now pretend that video stream got disabled, e.g. due to current tab going
1486 // into background.
1487 vstream->set_enabled(false, base::TimeDelta());
1488 // Since there's no other enabled streams, the preferred seeking stream should
1489 // still be the video stream.
1490 EXPECT_EQ(vstream, preferred_seeking_stream(base::TimeDelta()));
1491 }
1492
1493 TEST_F(FFmpegDemuxerTest, Seek_FallbackToDisabledAudioStream) {
1494 CreateDemuxer("bear-320x240-audio-only.webm");
1495 InitializeDemuxer();
1496 DemuxerStream* astream = demuxer_->GetStream(DemuxerStream::AUDIO);
1497 EXPECT_NE(nullptr, astream);
1498 EXPECT_EQ(nullptr, demuxer_->GetStream(DemuxerStream::VIDEO));
1499 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta()));
1500
1501 // Now pretend that audio stream got disabled.
1502 astream->set_enabled(false, base::TimeDelta());
1503 // Since there's no other enabled streams, the preferred seeking stream should
1504 // still be the audio stream.
1505 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta()));
1506 }
1507
1474 } // namespace media 1508 } // namespace media
OLDNEW
« media/filters/ffmpeg_demuxer.cc ('K') | « media/filters/ffmpeg_demuxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698