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

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

Issue 1716503002: Basic media tracks implementation for media stream parsers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DISALLOW_COPY_AND_ASSIGN in MediaTracks Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "media/base/audio_decoder_config.h" 16 #include "media/base/audio_decoder_config.h"
17 #include "media/base/decoder_buffer.h" 17 #include "media/base/decoder_buffer.h"
18 #include "media/base/media_track.h"
19 #include "media/base/media_tracks.h"
18 #include "media/base/mock_media_log.h" 20 #include "media/base/mock_media_log.h"
19 #include "media/base/stream_parser_buffer.h" 21 #include "media/base/stream_parser_buffer.h"
20 #include "media/base/test_data_util.h" 22 #include "media/base/test_data_util.h"
21 #include "media/base/text_track_config.h" 23 #include "media/base/text_track_config.h"
22 #include "media/base/video_decoder_config.h" 24 #include "media/base/video_decoder_config.h"
23 #include "media/formats/mp4/es_descriptor.h" 25 #include "media/formats/mp4/es_descriptor.h"
24 #include "media/formats/mp4/mp4_stream_parser.h" 26 #include "media/formats/mp4/mp4_stream_parser.h"
25 #include "media/media_features.h" 27 #include "media/media_features.h"
26 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return true; 91 return true;
90 } 92 }
91 93
92 void InitF(DemuxerStream::Liveness expected_liveness, 94 void InitF(DemuxerStream::Liveness expected_liveness,
93 const StreamParser::InitParameters& params) { 95 const StreamParser::InitParameters& params) {
94 DVLOG(1) << "InitF: dur=" << params.duration.InMilliseconds() 96 DVLOG(1) << "InitF: dur=" << params.duration.InMilliseconds()
95 << ", autoTimestampOffset=" << params.auto_update_timestamp_offset; 97 << ", autoTimestampOffset=" << params.auto_update_timestamp_offset;
96 EXPECT_EQ(expected_liveness, params.liveness); 98 EXPECT_EQ(expected_liveness, params.liveness);
97 } 99 }
98 100
99 bool NewConfigF(const AudioDecoderConfig& ac, 101 bool NewConfigF(scoped_ptr<MediaTracks> tracks,
100 const VideoDecoderConfig& vc,
101 const StreamParser::TextTrackConfigMap& tc) { 102 const StreamParser::TextTrackConfigMap& tc) {
102 DVLOG(1) << "NewConfigF: audio=" << ac.IsValidConfig() 103 DVLOG(1) << "NewConfigF: tracks=" << tracks->tracks().size();
103 << ", video=" << vc.IsValidConfig();
104 configs_received_ = true; 104 configs_received_ = true;
105 audio_decoder_config_ = ac; 105 audio_decoder_config_ = tracks->getFirstAudioConfig();
106 video_decoder_config_ = vc; 106 video_decoder_config_ = tracks->getFirstVideoConfig();
wolenetz 2016/02/26 00:06:21 ditto: let's preserve also the previous DVLOG(1) f
servolk 2016/02/26 01:56:33 Done.
107 return true; 107 return true;
108 } 108 }
109 109
110 void DumpBuffers(const std::string& label, 110 void DumpBuffers(const std::string& label,
111 const StreamParser::BufferQueue& buffers) { 111 const StreamParser::BufferQueue& buffers) {
112 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); 112 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size();
113 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); 113 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin();
114 buf != buffers.end(); buf++) { 114 buf != buffers.end(); buf++) {
115 DVLOG(3) << " n=" << buf - buffers.begin() 115 DVLOG(3) << " n=" << buf - buffers.begin()
116 << ", size=" << (*buf)->data_size() 116 << ", size=" << (*buf)->data_size()
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 InitializeParserAndExpectLiveness(DemuxerStream::LIVENESS_RECORDED); 385 InitializeParserAndExpectLiveness(DemuxerStream::LIVENESS_RECORDED);
386 scoped_refptr<DecoderBuffer> buffer = 386 scoped_refptr<DecoderBuffer> buffer =
387 ReadTestDataFile("bear-eac3-only-frag.mp4"); 387 ReadTestDataFile("bear-eac3-only-frag.mp4");
388 EXPECT_EQ(expect_success, 388 EXPECT_EQ(expect_success,
389 AppendDataInPieces(buffer->data(), buffer->data_size(), 512)); 389 AppendDataInPieces(buffer->data(), buffer->data_size(), 512));
390 } 390 }
391 391
392 } // namespace mp4 392 } // namespace mp4
393 } // namespace media 393 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698