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 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 LOG(ERROR) << "Unsupported sample size."; | 311 LOG(ERROR) << "Unsupported sample size."; |
312 return false; | 312 return false; |
313 } | 313 } |
314 | 314 |
315 is_audio_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; | 315 is_audio_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; |
316 DVLOG(1) << "is_audio_track_encrypted_: " << is_audio_track_encrypted_; | 316 DVLOG(1) << "is_audio_track_encrypted_: " << is_audio_track_encrypted_; |
317 audio_config.Initialize( | 317 audio_config.Initialize( |
318 codec, sample_format, channel_layout, sample_per_second, extra_data, | 318 codec, sample_format, channel_layout, sample_per_second, extra_data, |
319 is_audio_track_encrypted_ ? AesCtrEncryptionScheme() : Unencrypted(), | 319 is_audio_track_encrypted_ ? AesCtrEncryptionScheme() : Unencrypted(), |
320 base::TimeDelta(), 0); | 320 base::TimeDelta(), 0); |
| 321 if (!audio_config.IsValidConfig()) { |
| 322 MEDIA_LOG(ERROR, media_log_) << "Invalid audio decoder config: " |
| 323 << audio_config.AsHumanReadableString(); |
| 324 return false; |
| 325 } |
321 has_audio_ = true; | 326 has_audio_ = true; |
322 audio_track_id_ = track->header.track_id; | 327 audio_track_id_ = track->header.track_id; |
323 media_tracks->AddAudioTrack(audio_config, audio_track_id_, "main", | 328 media_tracks->AddAudioTrack(audio_config, audio_track_id_, "main", |
324 track->media.handler.name, | 329 track->media.handler.name, |
325 track->media.header.language()); | 330 track->media.header.language()); |
326 continue; | 331 continue; |
327 } | 332 } |
328 | 333 |
329 if (track->media.handler.type == kVideo) { | 334 if (track->media.handler.type == kVideo) { |
330 detected_video_track_count++; | 335 detected_video_track_count++; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 367 |
363 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; | 368 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; |
364 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_; | 369 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_; |
365 video_config.Initialize( | 370 video_config.Initialize( |
366 entry.video_codec, entry.video_codec_profile, PIXEL_FORMAT_YV12, | 371 entry.video_codec, entry.video_codec_profile, PIXEL_FORMAT_YV12, |
367 COLOR_SPACE_HD_REC709, coded_size, visible_rect, natural_size, | 372 COLOR_SPACE_HD_REC709, coded_size, visible_rect, natural_size, |
368 // No decoder-specific buffer needed for AVC; | 373 // No decoder-specific buffer needed for AVC; |
369 // SPS/PPS are embedded in the video stream | 374 // SPS/PPS are embedded in the video stream |
370 EmptyExtraData(), | 375 EmptyExtraData(), |
371 is_video_track_encrypted_ ? AesCtrEncryptionScheme() : Unencrypted()); | 376 is_video_track_encrypted_ ? AesCtrEncryptionScheme() : Unencrypted()); |
| 377 if (!video_config.IsValidConfig()) { |
| 378 MEDIA_LOG(ERROR, media_log_) << "Invalid video decoder config: " |
| 379 << video_config.AsHumanReadableString(); |
| 380 return false; |
| 381 } |
372 has_video_ = true; | 382 has_video_ = true; |
373 video_track_id_ = track->header.track_id; | 383 video_track_id_ = track->header.track_id; |
374 media_tracks->AddVideoTrack(video_config, video_track_id_, "main", | 384 media_tracks->AddVideoTrack(video_config, video_track_id_, "main", |
375 track->media.handler.name, | 385 track->media.handler.name, |
376 track->media.header.language()); | 386 track->media.header.language()); |
377 continue; | 387 continue; |
378 } | 388 } |
379 | 389 |
380 // TODO(wolenetz): Investigate support in MSE and Chrome MSE for CEA 608/708 | 390 // TODO(wolenetz): Investigate support in MSE and Chrome MSE for CEA 608/708 |
381 // embedded caption data in video track. At time of init segment parsing, we | 391 // embedded caption data in video track. At time of init segment parsing, we |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 runs.AdvanceSample(); | 708 runs.AdvanceSample(); |
699 } | 709 } |
700 runs.AdvanceRun(); | 710 runs.AdvanceRun(); |
701 } | 711 } |
702 | 712 |
703 return true; | 713 return true; |
704 } | 714 } |
705 | 715 |
706 } // namespace mp4 | 716 } // namespace mp4 |
707 } // namespace media | 717 } // namespace media |
OLD | NEW |