Chromium Code Reviews| 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 "media/formats/mp4/mp4_stream_parser.h" | 5 #include "media/formats/mp4/mp4_stream_parser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 EXPECT_EQ(expected_params.detected_video_track_count, | 110 EXPECT_EQ(expected_params.detected_video_track_count, |
| 111 params.detected_video_track_count); | 111 params.detected_video_track_count); |
| 112 EXPECT_EQ(expected_params.detected_text_track_count, | 112 EXPECT_EQ(expected_params.detected_text_track_count, |
| 113 params.detected_text_track_count); | 113 params.detected_text_track_count); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool NewConfigF(std::unique_ptr<MediaTracks> tracks, | 116 bool NewConfigF(std::unique_ptr<MediaTracks> tracks, |
| 117 const StreamParser::TextTrackConfigMap& tc) { | 117 const StreamParser::TextTrackConfigMap& tc) { |
| 118 configs_received_ = true; | 118 configs_received_ = true; |
| 119 CHECK(tracks.get()); | 119 CHECK(tracks.get()); |
| 120 DVLOG(1) << "NewConfigF: got " << tracks->tracks().size() << " tracks"; | |
| 121 for (const auto& track : tracks->tracks()) { | |
| 122 const auto& track_id = track->bytestream_track_id(); | |
| 123 if (track->type() == MediaTrack::Audio) { | |
| 124 const auto& audio_config = tracks->getAudioConfig(track_id); | |
|
wolenetz
2016/06/16 20:20:36
nit: why not drop this local var and just assign t
servolk
2016/06/16 21:14:07
Done.
| |
| 125 DVLOG(1) << "Audio track " << track_id | |
| 126 << " config=" << (audio_config.IsValidConfig() | |
| 127 ? audio_config.AsHumanReadableString() | |
| 128 : "INVALID"); | |
| 129 audio_decoder_config_ = audio_config; | |
| 130 } else if (track->type() == MediaTrack::Video) { | |
| 131 const auto& video_config = tracks->getVideoConfig(track_id); | |
| 132 DVLOG(1) << "Video track " << track_id | |
| 133 << " config=" << (video_config.IsValidConfig() | |
| 134 ? video_config.AsHumanReadableString() | |
| 135 : "INVALID"); | |
| 136 video_decoder_config_ = video_config; | |
| 137 } | |
| 138 } | |
| 120 media_tracks_ = std::move(tracks); | 139 media_tracks_ = std::move(tracks); |
| 121 audio_decoder_config_ = media_tracks_->getFirstAudioConfig(); | |
| 122 video_decoder_config_ = media_tracks_->getFirstVideoConfig(); | |
| 123 DVLOG(1) << "NewConfigF: track count=" << media_tracks_->tracks().size() | |
| 124 << " audio=" << audio_decoder_config_.IsValidConfig() | |
| 125 << " video=" << video_decoder_config_.IsValidConfig(); | |
| 126 return true; | 140 return true; |
| 127 } | 141 } |
| 128 | 142 |
| 129 void DumpBuffers(const std::string& label, | 143 void DumpBuffers(const std::string& label, |
| 130 const StreamParser::BufferQueue& buffers) { | 144 const StreamParser::BufferQueue& buffers) { |
| 131 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); | 145 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); |
| 132 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); | 146 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); |
| 133 buf != buffers.end(); buf++) { | 147 buf != buffers.end(); buf++) { |
| 134 DVLOG(3) << " n=" << buf - buffers.begin() | 148 DVLOG(3) << " n=" << buf - buffers.begin() |
| 135 << ", size=" << (*buf)->data_size() | 149 << ", size=" << (*buf)->data_size() |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 scoped_refptr<DecoderBuffer> buffer = | 534 scoped_refptr<DecoderBuffer> buffer = |
| 521 ReadTestDataFile("bear-1280x720-avt_subt_frag.mp4"); | 535 ReadTestDataFile("bear-1280x720-avt_subt_frag.mp4"); |
| 522 | 536 |
| 523 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.2")); | 537 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.2")); |
| 524 EXPECT_MEDIA_LOG(VideoCodecLog("avc1.64001F")); | 538 EXPECT_MEDIA_LOG(VideoCodecLog("avc1.64001F")); |
| 525 EXPECT_TRUE(AppendDataInPieces(buffer->data(), buffer->data_size(), 512)); | 539 EXPECT_TRUE(AppendDataInPieces(buffer->data(), buffer->data_size(), 512)); |
| 526 } | 540 } |
| 527 | 541 |
| 528 } // namespace mp4 | 542 } // namespace mp4 |
| 529 } // namespace media | 543 } // namespace media |
| OLD | NEW |