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

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

Issue 1735803002: Implemented passing media track info from ffmpeg into blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wolenetz@ CR feedback + better track info extraction in ffmpeg 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 << ", video=" << vc.IsValidConfig();
104 configs_received_ = true; 103 configs_received_ = true;
105 audio_decoder_config_ = ac; 104 audio_decoder_config_ = tracks->getFirstAudioConfig();
106 video_decoder_config_ = vc; 105 video_decoder_config_ = tracks->getFirstVideoConfig();
106 DVLOG(1) << "NewConfigF: track count=" << tracks->tracks().size()
107 << " audio=" << audio_decoder_config_.IsValidConfig()
108 << " video=" << video_decoder_config_.IsValidConfig();
107 return true; 109 return true;
108 } 110 }
109 111
110 void DumpBuffers(const std::string& label, 112 void DumpBuffers(const std::string& label,
111 const StreamParser::BufferQueue& buffers) { 113 const StreamParser::BufferQueue& buffers) {
112 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); 114 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size();
113 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); 115 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin();
114 buf != buffers.end(); buf++) { 116 buf != buffers.end(); buf++) {
115 DVLOG(3) << " n=" << buf - buffers.begin() 117 DVLOG(3) << " n=" << buf - buffers.begin()
116 << ", size=" << (*buf)->data_size() 118 << ", size=" << (*buf)->data_size()
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 386
385 InitializeParserAndExpectLiveness(DemuxerStream::LIVENESS_RECORDED); 387 InitializeParserAndExpectLiveness(DemuxerStream::LIVENESS_RECORDED);
386 scoped_refptr<DecoderBuffer> buffer = 388 scoped_refptr<DecoderBuffer> buffer =
387 ReadTestDataFile("bear-eac3-only-frag.mp4"); 389 ReadTestDataFile("bear-eac3-only-frag.mp4");
388 EXPECT_EQ(expect_success, 390 EXPECT_EQ(expect_success,
389 AppendDataInPieces(buffer->data(), buffer->data_size(), 512)); 391 AppendDataInPieces(buffer->data(), buffer->data_size(), 512));
390 } 392 }
391 393
392 } // namespace mp4 394 } // namespace mp4
393 } // namespace media 395 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/mp4_stream_parser.cc ('k') | media/formats/mpeg/mpeg_audio_stream_parser_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698