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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "media/base/mock_filters.h" | 7 #include "media/base/mock_filters.h" |
8 #include "media/base/test_data_util.h" | 8 #include "media/base/test_data_util.h" |
9 #include "media/ffmpeg/ffmpeg_common.h" | 9 #include "media/ffmpeg/ffmpeg_common.h" |
10 #include "media/filters/ffmpeg_glue.h" | 10 #include "media/filters/ffmpeg_glue.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 ASSERT_TRUE(glue_->OpenContext()); | 228 ASSERT_TRUE(glue_->OpenContext()); |
229 } | 229 } |
230 | 230 |
231 // Ensure destruction release the appropriate resources when OpenContext() is | 231 // Ensure destruction release the appropriate resources when OpenContext() is |
232 // called and streams have been opened. | 232 // called and streams have been opened. |
233 TEST_F(FFmpegGlueDestructionTest, WithOpenWithOpenStreams) { | 233 TEST_F(FFmpegGlueDestructionTest, WithOpenWithOpenStreams) { |
234 Initialize("bear-320x240.webm"); | 234 Initialize("bear-320x240.webm"); |
235 ASSERT_TRUE(glue_->OpenContext()); | 235 ASSERT_TRUE(glue_->OpenContext()); |
236 ASSERT_GT(glue_->format_context()->nb_streams, 0u); | 236 ASSERT_GT(glue_->format_context()->nb_streams, 0u); |
237 | 237 |
238 AVCodecContext* context = glue_->format_context()->streams[0]->codec; | 238 // Pick the audio stream (1) so this works when the ffmpeg video decoders are |
239 ASSERT_EQ(avcodec_open2( | 239 // disabled. |
240 context, avcodec_find_decoder(context->codec_id), NULL), 0); | 240 AVCodecContext* context = glue_->format_context()->streams[1]->codec; |
| 241 ASSERT_EQ(0, avcodec_open2( |
| 242 context, avcodec_find_decoder(context->codec_id), NULL)); |
241 } | 243 } |
242 | 244 |
243 } // namespace media | 245 } // namespace media |
OLD | NEW |