| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <deque> | 5 #include <deque> |
| 6 | 6 |
| 7 #include "media/base/filters.h" | 7 #include "media/base/filters.h" |
| 8 #include "media/base/mock_ffmpeg.h" | 8 #include "media/base/mock_ffmpeg.h" |
| 9 #include "media/base/mock_filter_host.h" | 9 #include "media/base/mock_filter_host.h" |
| 10 #include "media/base/mock_filters.h" | 10 #include "media/base/mock_filters.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 media_format.SetAsString(MediaFormat::kMimeType, | 64 media_format.SetAsString(MediaFormat::kMimeType, |
| 65 mime_type::kApplicationOctetStream); | 65 mime_type::kApplicationOctetStream); |
| 66 demuxer_ = factory_->Create<FFmpegDemuxer>(media_format); | 66 demuxer_ = factory_->Create<FFmpegDemuxer>(media_format); |
| 67 DCHECK(demuxer_); | 67 DCHECK(demuxer_); |
| 68 | 68 |
| 69 // Provide a message loop. | 69 // Provide a message loop. |
| 70 demuxer_->SetMessageLoop(&message_loop_); | 70 demuxer_->SetMessageLoop(&message_loop_); |
| 71 | 71 |
| 72 // Prepare a filter host and data source for the demuxer. | 72 // Prepare a filter host and data source for the demuxer. |
| 73 pipeline_.reset(new MockPipeline()); | 73 pipeline_.reset(new MockPipeline()); |
| 74 filter_host_.reset(new MockFilterHost<Demuxer>(pipeline_.get(), demuxer_)); | 74 filter_host_.reset(new old_mocks::MockFilterHost<Demuxer>(pipeline_.get(), |
| 75 demuxer_)); |
| 75 data_source_ = new StrictMock<MockDataSource>(); | 76 data_source_ = new StrictMock<MockDataSource>(); |
| 76 | 77 |
| 77 // Initialize FFmpeg fixtures. | 78 // Initialize FFmpeg fixtures. |
| 78 memset(&format_context_, 0, sizeof(format_context_)); | 79 memset(&format_context_, 0, sizeof(format_context_)); |
| 79 memset(&streams_, 0, sizeof(streams_)); | 80 memset(&streams_, 0, sizeof(streams_)); |
| 80 memset(&codecs_, 0, sizeof(codecs_)); | 81 memset(&codecs_, 0, sizeof(codecs_)); |
| 81 | 82 |
| 82 // Initialize AVCodexContext structures. | 83 // Initialize AVCodexContext structures. |
| 83 codecs_[AV_STREAM_DATA].codec_type = CODEC_TYPE_DATA; | 84 codecs_[AV_STREAM_DATA].codec_type = CODEC_TYPE_DATA; |
| 84 codecs_[AV_STREAM_DATA].codec_id = CODEC_ID_NONE; | 85 codecs_[AV_STREAM_DATA].codec_id = CODEC_ID_NONE; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 message_loop_.RunAllPending(); | 142 message_loop_.RunAllPending(); |
| 142 EXPECT_TRUE(filter_host_->WaitForInitialized()); | 143 EXPECT_TRUE(filter_host_->WaitForInitialized()); |
| 143 EXPECT_TRUE(filter_host_->IsInitialized()); | 144 EXPECT_TRUE(filter_host_->IsInitialized()); |
| 144 EXPECT_EQ(PIPELINE_OK, pipeline_->GetError()); | 145 EXPECT_EQ(PIPELINE_OK, pipeline_->GetError()); |
| 145 } | 146 } |
| 146 | 147 |
| 147 // Fixture members. | 148 // Fixture members. |
| 148 scoped_refptr<FilterFactory> factory_; | 149 scoped_refptr<FilterFactory> factory_; |
| 149 scoped_refptr<FFmpegDemuxer> demuxer_; | 150 scoped_refptr<FFmpegDemuxer> demuxer_; |
| 150 scoped_ptr<MockPipeline> pipeline_; | 151 scoped_ptr<MockPipeline> pipeline_; |
| 151 scoped_ptr<MockFilterHost<Demuxer> > filter_host_; | 152 scoped_ptr<old_mocks::MockFilterHost<Demuxer> > filter_host_; |
| 152 scoped_refptr<StrictMock<MockDataSource> > data_source_; | 153 scoped_refptr<StrictMock<MockDataSource> > data_source_; |
| 153 MessageLoop message_loop_; | 154 MessageLoop message_loop_; |
| 154 | 155 |
| 155 // FFmpeg fixtures. | 156 // FFmpeg fixtures. |
| 156 AVFormatContext format_context_; | 157 AVFormatContext format_context_; |
| 157 AVCodecContext codecs_[AV_STREAM_MAX]; | 158 AVCodecContext codecs_[AV_STREAM_MAX]; |
| 158 AVStream streams_[AV_STREAM_MAX]; | 159 AVStream streams_[AV_STREAM_MAX]; |
| 159 MockFFmpeg mock_ffmpeg_; | 160 MockFFmpeg mock_ffmpeg_; |
| 160 | 161 |
| 161 private: | 162 private: |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 | 650 |
| 650 // Attempt the read... | 651 // Attempt the read... |
| 651 audio->Read(callback.release()); | 652 audio->Read(callback.release()); |
| 652 message_loop_.RunAllPending(); | 653 message_loop_.RunAllPending(); |
| 653 | 654 |
| 654 // ...and verify that |callback| was deleted. | 655 // ...and verify that |callback| was deleted. |
| 655 MockFFmpeg::get()->CheckPoint(1); | 656 MockFFmpeg::get()->CheckPoint(1); |
| 656 } | 657 } |
| 657 | 658 |
| 658 } // namespace media | 659 } // namespace media |
| OLD | NEW |