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

Side by Side Diff: media/mp4/mp4_stream_parser_unittest.cc

Issue 20123002: Add Chromium-side support for SourceBuffer.appendWindowStart and SourceBuffer.appendWindowEnd. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 << ", dur=" << duration.InMilliseconds(); 63 << ", dur=" << duration.InMilliseconds();
64 } 64 }
65 65
66 bool NewConfigF(const AudioDecoderConfig& ac, const VideoDecoderConfig& vc) { 66 bool NewConfigF(const AudioDecoderConfig& ac, const VideoDecoderConfig& vc) {
67 DVLOG(1) << "NewConfigF: audio=" << ac.IsValidConfig() 67 DVLOG(1) << "NewConfigF: audio=" << ac.IsValidConfig()
68 << ", video=" << vc.IsValidConfig(); 68 << ", video=" << vc.IsValidConfig();
69 configs_received_ = true; 69 configs_received_ = true;
70 return true; 70 return true;
71 } 71 }
72 72
73 bool NewBuffersF(const StreamParser::BufferQueue& bufs) { 73
74 DVLOG(2) << "NewBuffersF: " << bufs.size() << " buffers"; 74 void DumpBuffers(const std::string& label,
75 for (StreamParser::BufferQueue::const_iterator buf = bufs.begin(); 75 const StreamParser::BufferQueue& buffers) {
76 buf != bufs.end(); buf++) { 76 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size();
77 DVLOG(3) << " n=" << buf - bufs.begin() 77 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin();
78 buf != buffers.end(); buf++) {
79 DVLOG(3) << " n=" << buf - buffers.begin()
78 << ", size=" << (*buf)->data_size() 80 << ", size=" << (*buf)->data_size()
79 << ", dur=" << (*buf)->duration().InMilliseconds(); 81 << ", dur=" << (*buf)->duration().InMilliseconds();
80 EXPECT_GE((*buf)->timestamp(), segment_start_); 82 EXPECT_GE((*buf)->timestamp(), segment_start_);
81 } 83 }
84 }
85
86 bool NewBuffersF(const StreamParser::BufferQueue& audio_buffers,
87 const StreamParser::BufferQueue& video_buffers) {
88 DumpBuffers("audio_buffers", audio_buffers);
89 DumpBuffers("video_buffers", video_buffers);
82 return true; 90 return true;
83 } 91 }
84 92
85 bool NewTextBuffersF(TextTrack* text_track, 93 bool NewTextBuffersF(TextTrack* text_track,
86 const StreamParser::BufferQueue& buffers) { 94 const StreamParser::BufferQueue& buffers) {
87 return true; 95 return true;
88 } 96 }
89 97
90 void KeyNeededF(const std::string& type, 98 void KeyNeededF(const std::string& type,
91 scoped_ptr<uint8[]> init_data, int init_data_size) { 99 scoped_ptr<uint8[]> init_data, int init_data_size) {
(...skipping 17 matching lines...) Expand all
109 117
110 void EndOfSegmentF() { 118 void EndOfSegmentF() {
111 DVLOG(1) << "EndOfSegmentF()"; 119 DVLOG(1) << "EndOfSegmentF()";
112 } 120 }
113 121
114 void InitializeParser() { 122 void InitializeParser() {
115 parser_->Init( 123 parser_->Init(
116 base::Bind(&MP4StreamParserTest::InitF, base::Unretained(this)), 124 base::Bind(&MP4StreamParserTest::InitF, base::Unretained(this)),
117 base::Bind(&MP4StreamParserTest::NewConfigF, base::Unretained(this)), 125 base::Bind(&MP4StreamParserTest::NewConfigF, base::Unretained(this)),
118 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)), 126 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)),
119 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)),
120 base::Bind(&MP4StreamParserTest::NewTextBuffersF, 127 base::Bind(&MP4StreamParserTest::NewTextBuffersF,
121 base::Unretained(this)), 128 base::Unretained(this)),
122 base::Bind(&MP4StreamParserTest::KeyNeededF, base::Unretained(this)), 129 base::Bind(&MP4StreamParserTest::KeyNeededF, base::Unretained(this)),
123 base::Bind(&MP4StreamParserTest::AddTextTrackF, base::Unretained(this)), 130 base::Bind(&MP4StreamParserTest::AddTextTrackF, base::Unretained(this)),
124 base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this)), 131 base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this)),
125 base::Bind(&MP4StreamParserTest::EndOfSegmentF, 132 base::Bind(&MP4StreamParserTest::EndOfSegmentF,
126 base::Unretained(this)), 133 base::Unretained(this)),
127 LogCB()); 134 LogCB());
128 } 135 }
129 136
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 EXPECT_TRUE(AppendDataInPieces(buffer->data() + kFirstMoofOffset, 210 EXPECT_TRUE(AppendDataInPieces(buffer->data() + kFirstMoofOffset,
204 buffer->data_size() - kFirstMoofOffset, 211 buffer->data_size() - kFirstMoofOffset,
205 512)); 212 512));
206 } 213 }
207 214
208 // TODO(strobe): Create and test media which uses CENC auxiliary info stored 215 // TODO(strobe): Create and test media which uses CENC auxiliary info stored
209 // inside a private box 216 // inside a private box
210 217
211 } // namespace mp4 218 } // namespace mp4
212 } // namespace media 219 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698