OLD | NEW |
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO); | 430 DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO); |
431 | 431 |
432 // Depending on where in the reading process ffmpeg is, an error may cause the | 432 // Depending on where in the reading process ffmpeg is, an error may cause the |
433 // stream to be marked as EOF. Simulate this here to ensure it is properly | 433 // stream to be marked as EOF. Simulate this here to ensure it is properly |
434 // cleared by the AbortPendingReads() call. | 434 // cleared by the AbortPendingReads() call. |
435 format_context()->pb->eof_reached = 1; | 435 format_context()->pb->eof_reached = 1; |
436 audio->Read(NewReadCB(FROM_HERE, 29, 0, true, DemuxerStream::kAborted)); | 436 audio->Read(NewReadCB(FROM_HERE, 29, 0, true, DemuxerStream::kAborted)); |
437 demuxer_->AbortPendingReads(); | 437 demuxer_->AbortPendingReads(); |
438 base::RunLoop().Run(); | 438 base::RunLoop().Run(); |
439 | 439 |
| 440 // Additional reads should also be aborted (until a Seek()). |
| 441 audio->Read(NewReadCB(FROM_HERE, 29, 0, true, DemuxerStream::kAborted)); |
| 442 base::RunLoop().Run(); |
| 443 |
440 // Ensure blocking thread has completed outstanding work. | 444 // Ensure blocking thread has completed outstanding work. |
441 demuxer_->Stop(); | 445 demuxer_->Stop(); |
442 EXPECT_EQ(format_context()->pb->eof_reached, 0); | 446 EXPECT_EQ(format_context()->pb->eof_reached, 0); |
443 | 447 |
444 // Calling abort after stop should not crash. | 448 // Calling abort after stop should not crash. |
445 demuxer_->AbortPendingReads(); | 449 demuxer_->AbortPendingReads(); |
446 demuxer_.reset(); | 450 demuxer_.reset(); |
447 } | 451 } |
448 | 452 |
449 TEST_F(FFmpegDemuxerTest, Read_Audio) { | 453 TEST_F(FFmpegDemuxerTest, Read_Audio) { |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 | 1469 |
1466 const AudioDecoderConfig& audio_config = stream->audio_decoder_config(); | 1470 const AudioDecoderConfig& audio_config = stream->audio_decoder_config(); |
1467 EXPECT_EQ(kCodecFLAC, audio_config.codec()); | 1471 EXPECT_EQ(kCodecFLAC, audio_config.codec()); |
1468 EXPECT_EQ(32, audio_config.bits_per_channel()); | 1472 EXPECT_EQ(32, audio_config.bits_per_channel()); |
1469 EXPECT_EQ(CHANNEL_LAYOUT_MONO, audio_config.channel_layout()); | 1473 EXPECT_EQ(CHANNEL_LAYOUT_MONO, audio_config.channel_layout()); |
1470 EXPECT_EQ(44100, audio_config.samples_per_second()); | 1474 EXPECT_EQ(44100, audio_config.samples_per_second()); |
1471 EXPECT_EQ(kSampleFormatS32, audio_config.sample_format()); | 1475 EXPECT_EQ(kSampleFormatS32, audio_config.sample_format()); |
1472 } | 1476 } |
1473 | 1477 |
1474 } // namespace media | 1478 } // namespace media |
OLD | NEW |