OLD | NEW |
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/fourccs.h" | 26 #include "media/formats/mp4/fourccs.h" |
25 #include "media/formats/mp4/mp4_stream_parser.h" | 27 #include "media/formats/mp4/mp4_stream_parser.h" |
26 #include "media/media_features.h" | 28 #include "media/media_features.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return true; | 92 return true; |
91 } | 93 } |
92 | 94 |
93 void InitF(DemuxerStream::Liveness expected_liveness, | 95 void InitF(DemuxerStream::Liveness expected_liveness, |
94 const StreamParser::InitParameters& params) { | 96 const StreamParser::InitParameters& params) { |
95 DVLOG(1) << "InitF: dur=" << params.duration.InMilliseconds() | 97 DVLOG(1) << "InitF: dur=" << params.duration.InMilliseconds() |
96 << ", autoTimestampOffset=" << params.auto_update_timestamp_offset; | 98 << ", autoTimestampOffset=" << params.auto_update_timestamp_offset; |
97 EXPECT_EQ(expected_liveness, params.liveness); | 99 EXPECT_EQ(expected_liveness, params.liveness); |
98 } | 100 } |
99 | 101 |
100 bool NewConfigF(const AudioDecoderConfig& ac, | 102 bool NewConfigF(scoped_ptr<MediaTracks> tracks, |
101 const VideoDecoderConfig& vc, | |
102 const StreamParser::TextTrackConfigMap& tc) { | 103 const StreamParser::TextTrackConfigMap& tc) { |
103 DVLOG(1) << "NewConfigF: audio=" << ac.IsValidConfig() | |
104 << ", video=" << vc.IsValidConfig(); | |
105 configs_received_ = true; | 104 configs_received_ = true; |
106 audio_decoder_config_ = ac; | 105 audio_decoder_config_ = tracks->getFirstAudioConfig(); |
107 video_decoder_config_ = vc; | 106 video_decoder_config_ = tracks->getFirstVideoConfig(); |
| 107 DVLOG(1) << "NewConfigF: track count=" << tracks->tracks().size() |
| 108 << " audio=" << audio_decoder_config_.IsValidConfig() |
| 109 << " video=" << video_decoder_config_.IsValidConfig(); |
108 return true; | 110 return true; |
109 } | 111 } |
110 | 112 |
111 void DumpBuffers(const std::string& label, | 113 void DumpBuffers(const std::string& label, |
112 const StreamParser::BufferQueue& buffers) { | 114 const StreamParser::BufferQueue& buffers) { |
113 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); | 115 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); |
114 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); | 116 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); |
115 buf != buffers.end(); buf++) { | 117 buf != buffers.end(); buf++) { |
116 DVLOG(3) << " n=" << buf - buffers.begin() | 118 DVLOG(3) << " n=" << buf - buffers.begin() |
117 << ", size=" << (*buf)->data_size() | 119 << ", size=" << (*buf)->data_size() |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 398 |
397 // Invalid FOURCC should also print whenever ASCII values are printable. | 399 // Invalid FOURCC should also print whenever ASCII values are printable. |
398 EXPECT_EQ("fake", FourCCToString(static_cast<FourCC>(0x66616b65))); | 400 EXPECT_EQ("fake", FourCCToString(static_cast<FourCC>(0x66616b65))); |
399 | 401 |
400 // Invalid FORCC with non-printable values should not give error message. | 402 // Invalid FORCC with non-printable values should not give error message. |
401 EXPECT_EQ("0x66616b00", FourCCToString(static_cast<FourCC>(0x66616b00))); | 403 EXPECT_EQ("0x66616b00", FourCCToString(static_cast<FourCC>(0x66616b00))); |
402 } | 404 } |
403 | 405 |
404 } // namespace mp4 | 406 } // namespace mp4 |
405 } // namespace media | 407 } // namespace media |
OLD | NEW |