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

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

Issue 2613623002: media: Continue aborting FFMpegDemuxerStream::Read() calls until Seek(). (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698