Index: media/filters/ffmpeg_demuxer_unittest.cc |
=================================================================== |
--- media/filters/ffmpeg_demuxer_unittest.cc (revision 90887) |
+++ media/filters/ffmpeg_demuxer_unittest.cc (working copy) |
@@ -82,15 +82,15 @@ |
memset(&codecs_, 0, sizeof(codecs_)); |
// Initialize AVCodecContext structures. |
- codecs_[AV_STREAM_DATA].codec_type = CODEC_TYPE_DATA; |
+ codecs_[AV_STREAM_DATA].codec_type = AVMEDIA_TYPE_DATA; |
codecs_[AV_STREAM_DATA].codec_id = CODEC_ID_NONE; |
- codecs_[AV_STREAM_VIDEO].codec_type = CODEC_TYPE_VIDEO; |
+ codecs_[AV_STREAM_VIDEO].codec_type = AVMEDIA_TYPE_VIDEO; |
codecs_[AV_STREAM_VIDEO].codec_id = CODEC_ID_THEORA; |
codecs_[AV_STREAM_VIDEO].width = kWidth; |
codecs_[AV_STREAM_VIDEO].height = kHeight; |
- codecs_[AV_STREAM_AUDIO].codec_type = CODEC_TYPE_AUDIO; |
+ codecs_[AV_STREAM_AUDIO].codec_type = AVMEDIA_TYPE_AUDIO; |
codecs_[AV_STREAM_AUDIO].codec_id = CODEC_ID_VORBIS; |
codecs_[AV_STREAM_AUDIO].channels = kChannels; |
codecs_[AV_STREAM_AUDIO].sample_rate = kSampleRate; |
@@ -101,6 +101,10 @@ |
// Initialize AVStream and AVFormatContext structures. We set the time base |
// of the streams such that duration is reported in microseconds. |
format_context_.nb_streams = AV_STREAM_MAX; |
+ format_context_.streams = new AVStream*[AV_STREAM_MAX]; |
+ // should probably be the line below but it crashes inside of av_malloc |
+ // format_context_.streams = reinterpret_cast<AVStream **>( |
+ // av_malloc(sizeof(AVStream *) * AV_STREAM_MAX)); |
scherkus (not reviewing)
2011/06/29 17:00:36
this is because media_unittests doesn't load the r
ilja
2011/06/29 21:40:05
Done.
|
for (size_t i = 0; i < AV_STREAM_MAX; ++i) { |
format_context_.streams[i] = &streams_[i]; |
streams_[i].codec = &codecs_[i]; |
@@ -116,7 +120,6 @@ |
// Finish up any remaining tasks. |
message_loop_.RunAllPending(); |
- |
// Release the reference to the demuxer. |
demuxer_ = NULL; |
} |
@@ -190,7 +193,7 @@ |
EXPECT_CALL(mock_ffmpeg_, AVOpenInputFile(_, _, NULL, 0, NULL)) |
.WillOnce(DoAll(SetArgumentPointee<0>(&format_context_), Return(0))); |
EXPECT_CALL(mock_ffmpeg_, AVFindStreamInfo(&format_context_)) |
- .WillOnce(Return(AVERROR_IO)); |
+ .WillOnce(Return(AVERROR(EIO))); |
EXPECT_CALL(mock_ffmpeg_, AVCloseInputFile(&format_context_)); |
demuxer_->Initialize( |
@@ -266,7 +269,7 @@ |
EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) |
.WillOnce(CreatePacketNoCount(AV_STREAM_DATA, kNullData, 0)); |
EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) |
- .WillOnce(Return(AVERROR_IO)); |
+ .WillOnce(Return(AVERROR(EIO))); |
// Attempt a read from the audio stream and run the message loop until done. |
scoped_refptr<DemuxerStream> audio = |
@@ -474,7 +477,7 @@ |
EXPECT_CALL(mock_ffmpeg_, AVFreePacket(_)).Times(AnyNumber()); |
EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) |
- .WillOnce(Return(AVERROR_IO)); |
+ .WillOnce(Return(AVERROR(EIO))); |
// We should now expect an end of stream buffer. |
scoped_refptr<DemuxerStream> audio = |
@@ -717,7 +720,7 @@ |
// Then an end-of-stream packet is read. |
EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) |
- .WillOnce(Return(AVERROR_IO)); |
+ .WillOnce(Return(AVERROR(EIO))); |
// Get our streams. |
scoped_refptr<DemuxerStream> video = |