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

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

Issue 6993042: ffmpeg chromium glue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: once more new test_expectations.txt Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "media/base/media.h" 9 #include "media/base/media.h"
10 #include "media/base/mock_callback.h" 10 #include "media/base/mock_callback.h"
(...skipping 27 matching lines...) Expand all
38 VIDEO, 38 VIDEO,
39 MAX_CODECS_INDEX 39 MAX_CODECS_INDEX
40 }; 40 };
41 41
42 ChunkDemuxerTest() 42 ChunkDemuxerTest()
43 : demuxer_(new ChunkDemuxer()) { 43 : demuxer_(new ChunkDemuxer()) {
44 memset(&format_context_, 0, sizeof(format_context_)); 44 memset(&format_context_, 0, sizeof(format_context_));
45 memset(&streams_, 0, sizeof(streams_)); 45 memset(&streams_, 0, sizeof(streams_));
46 memset(&codecs_, 0, sizeof(codecs_)); 46 memset(&codecs_, 0, sizeof(codecs_));
47 47
48 codecs_[VIDEO].codec_type = CODEC_TYPE_VIDEO; 48 codecs_[VIDEO].codec_type = AVMEDIA_TYPE_VIDEO;
49 codecs_[VIDEO].codec_id = CODEC_ID_VP8; 49 codecs_[VIDEO].codec_id = CODEC_ID_VP8;
50 codecs_[VIDEO].width = 320; 50 codecs_[VIDEO].width = 320;
51 codecs_[VIDEO].height = 240; 51 codecs_[VIDEO].height = 240;
52 52
53 codecs_[AUDIO].codec_type = CODEC_TYPE_AUDIO; 53 codecs_[AUDIO].codec_type = AVMEDIA_TYPE_AUDIO;
54 codecs_[AUDIO].codec_id = CODEC_ID_VORBIS; 54 codecs_[AUDIO].codec_id = CODEC_ID_VORBIS;
55 codecs_[AUDIO].channels = 2; 55 codecs_[AUDIO].channels = 2;
56 codecs_[AUDIO].sample_rate = 44100; 56 codecs_[AUDIO].sample_rate = 44100;
57 } 57 }
58 58
59 virtual ~ChunkDemuxerTest() { 59 virtual ~ChunkDemuxerTest() {
60 if (demuxer_.get()) 60 if (demuxer_.get())
61 demuxer_->Shutdown(); 61 demuxer_->Shutdown();
62 if (format_context_.streams) {
63 delete[] format_context_.streams;
64 format_context_.streams = NULL;
65 format_context_.nb_streams = 0;
66 }
62 } 67 }
63 68
64 void ReadFile(const std::string& name, scoped_array<uint8>* buffer, 69 void ReadFile(const std::string& name, scoped_array<uint8>* buffer,
65 int* size) { 70 int* size) {
66 FilePath file_path; 71 FilePath file_path;
67 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); 72 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &file_path));
68 file_path = file_path.Append(FILE_PATH_LITERAL("media")) 73 file_path = file_path.Append(FILE_PATH_LITERAL("media"))
69 .Append(FILE_PATH_LITERAL("test")) 74 .Append(FILE_PATH_LITERAL("test"))
70 .Append(FILE_PATH_LITERAL("data")) 75 .Append(FILE_PATH_LITERAL("data"))
71 .AppendASCII(name); 76 .AppendASCII(name);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 135 }
131 136
132 if (has_video) { 137 if (has_video) {
133 memcpy(buf, video_track_entry.get(), video_track_entry_size); 138 memcpy(buf, video_track_entry.get(), video_track_entry_size);
134 buf += video_track_entry_size; 139 buf += video_track_entry_size;
135 } 140 }
136 } 141 }
137 142
138 void SetupAVFormatContext(bool has_audio, bool has_video) { 143 void SetupAVFormatContext(bool has_audio, bool has_video) {
139 int i = 0; 144 int i = 0;
145 format_context_.streams = new AVStream *[MAX_CODECS_INDEX];
140 if (has_audio) { 146 if (has_audio) {
141 format_context_.streams[i] = &streams_[i]; 147 format_context_.streams[i] = &streams_[i];
142 streams_[i].codec = &codecs_[AUDIO]; 148 streams_[i].codec = &codecs_[AUDIO];
143 streams_[i].duration = 100; 149 streams_[i].duration = 100;
144 streams_[i].time_base.den = base::Time::kMicrosecondsPerSecond; 150 streams_[i].time_base.den = base::Time::kMicrosecondsPerSecond;
145 streams_[i].time_base.num = 1; 151 streams_[i].time_base.num = 1;
146 i++; 152 i++;
147 } 153 }
148 154
149 if (has_video) { 155 if (has_video) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 408
403 cb.SetClusterTimecode(5); 409 cb.SetClusterTimecode(5);
404 AddSimpleBlock(&cb, kAudioTrackNum, 5); 410 AddSimpleBlock(&cb, kAudioTrackNum, 5);
405 AddSimpleBlock(&cb, kVideoTrackNum, 7); 411 AddSimpleBlock(&cb, kVideoTrackNum, 7);
406 scoped_ptr<Cluster> clusterE(cb.Finish()); 412 scoped_ptr<Cluster> clusterE(cb.Finish());
407 413
408 EXPECT_FALSE(demuxer_->AddData(clusterE->data(), clusterE->size())); 414 EXPECT_FALSE(demuxer_->AddData(clusterE->data(), clusterE->size()));
409 } 415 }
410 416
411 } // namespace media 417 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698