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

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 1041353002: media-internals: Differentiate error, info, and debug log messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer comments Created 5 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 10
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 DCHECK(init_segment_received_cb_.is_null()); 327 DCHECK(init_segment_received_cb_.is_null());
328 append_window_start_during_append_ = append_window_start; 328 append_window_start_during_append_ = append_window_start;
329 append_window_end_during_append_ = append_window_end; 329 append_window_end_during_append_ = append_window_end;
330 timestamp_offset_during_append_ = timestamp_offset; 330 timestamp_offset_during_append_ = timestamp_offset;
331 init_segment_received_cb_= init_segment_received_cb; 331 init_segment_received_cb_= init_segment_received_cb;
332 332
333 // TODO(wolenetz/acolwell): Curry and pass a NewBuffersCB here bound with 333 // TODO(wolenetz/acolwell): Curry and pass a NewBuffersCB here bound with
334 // append window and timestamp offset pointer. See http://crbug.com/351454. 334 // append window and timestamp offset pointer. See http://crbug.com/351454.
335 bool result = stream_parser_->Parse(data, length); 335 bool result = stream_parser_->Parse(data, length);
336 if (!result) { 336 if (!result) {
337 MEDIA_LOG(log_cb_) 337 MEDIA_LOG(ERROR, log_cb_)
338 << __FUNCTION__ << ": stream parsing failed." 338 << __FUNCTION__ << ": stream parsing failed."
339 << " Data size=" << length 339 << " Data size=" << length
340 << " append_window_start=" << append_window_start.InSecondsF() 340 << " append_window_start=" << append_window_start.InSecondsF()
341 << " append_window_end=" << append_window_end.InSecondsF(); 341 << " append_window_end=" << append_window_end.InSecondsF();
342 } 342 }
343 timestamp_offset_during_append_ = NULL; 343 timestamp_offset_during_append_ = NULL;
344 init_segment_received_cb_.Reset(); 344 init_segment_received_cb_.Reset();
345 return result; 345 return result;
346 } 346 }
347 347
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 DCHECK(!init_segment_received_cb_.is_null()); 565 DCHECK(!init_segment_received_cb_.is_null());
566 566
567 if (!audio_config.IsValidConfig() && !video_config.IsValidConfig()) { 567 if (!audio_config.IsValidConfig() && !video_config.IsValidConfig()) {
568 DVLOG(1) << "OnNewConfigs() : Audio & video config are not valid!"; 568 DVLOG(1) << "OnNewConfigs() : Audio & video config are not valid!";
569 return false; 569 return false;
570 } 570 }
571 571
572 // Signal an error if we get configuration info for stream types that weren't 572 // Signal an error if we get configuration info for stream types that weren't
573 // specified in AddId() or more configs after a stream is initialized. 573 // specified in AddId() or more configs after a stream is initialized.
574 if (allow_audio != audio_config.IsValidConfig()) { 574 if (allow_audio != audio_config.IsValidConfig()) {
575 MEDIA_LOG(log_cb_) 575 MEDIA_LOG(ERROR, log_cb_)
576 << "Initialization segment" 576 << "Initialization segment"
577 << (audio_config.IsValidConfig() ? " has" : " does not have") 577 << (audio_config.IsValidConfig() ? " has" : " does not have")
578 << " an audio track, but the mimetype" 578 << " an audio track, but the mimetype"
579 << (allow_audio ? " specifies" : " does not specify") 579 << (allow_audio ? " specifies" : " does not specify")
580 << " an audio codec."; 580 << " an audio codec.";
581 return false; 581 return false;
582 } 582 }
583 583
584 if (allow_video != video_config.IsValidConfig()) { 584 if (allow_video != video_config.IsValidConfig()) {
585 MEDIA_LOG(log_cb_) 585 MEDIA_LOG(ERROR, log_cb_)
586 << "Initialization segment" 586 << "Initialization segment"
587 << (video_config.IsValidConfig() ? " has" : " does not have") 587 << (video_config.IsValidConfig() ? " has" : " does not have")
588 << " a video track, but the mimetype" 588 << " a video track, but the mimetype"
589 << (allow_video ? " specifies" : " does not specify") 589 << (allow_video ? " specifies" : " does not specify")
590 << " a video codec."; 590 << " a video codec.";
591 return false; 591 return false;
592 } 592 }
593 593
594 bool success = true; 594 bool success = true;
595 if (audio_config.IsValidConfig()) { 595 if (audio_config.IsValidConfig()) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 648 }
649 649
650 typedef StreamParser::TextTrackConfigMap::const_iterator TextConfigItr; 650 typedef StreamParser::TextTrackConfigMap::const_iterator TextConfigItr;
651 if (text_stream_map_.empty()) { 651 if (text_stream_map_.empty()) {
652 for (TextConfigItr itr = text_configs.begin(); 652 for (TextConfigItr itr = text_configs.begin();
653 itr != text_configs.end(); ++itr) { 653 itr != text_configs.end(); ++itr) {
654 ChunkDemuxerStream* const text_stream = 654 ChunkDemuxerStream* const text_stream =
655 create_demuxer_stream_cb_.Run(DemuxerStream::TEXT); 655 create_demuxer_stream_cb_.Run(DemuxerStream::TEXT);
656 if (!frame_processor_->AddTrack(itr->first, text_stream)) { 656 if (!frame_processor_->AddTrack(itr->first, text_stream)) {
657 success &= false; 657 success &= false;
658 MEDIA_LOG(log_cb_) << "Failed to add text track ID " << itr->first 658 MEDIA_LOG(ERROR, log_cb_) << "Failed to add text track ID "
659 << " to frame processor."; 659 << itr->first << " to frame processor.";
660 break; 660 break;
661 } 661 }
662 text_stream->UpdateTextConfig(itr->second, log_cb_); 662 text_stream->UpdateTextConfig(itr->second, log_cb_);
663 text_stream_map_[itr->first] = text_stream; 663 text_stream_map_[itr->first] = text_stream;
664 new_text_track_cb_.Run(text_stream, itr->second); 664 new_text_track_cb_.Run(text_stream, itr->second);
665 } 665 }
666 } else { 666 } else {
667 const size_t text_count = text_stream_map_.size(); 667 const size_t text_count = text_stream_map_.size();
668 if (text_configs.size() != text_count) { 668 if (text_configs.size() != text_count) {
669 success &= false; 669 success &= false;
670 MEDIA_LOG(log_cb_) << "The number of text track configs changed."; 670 MEDIA_LOG(ERROR, log_cb_) << "The number of text track configs changed.";
671 } else if (text_count == 1) { 671 } else if (text_count == 1) {
672 TextConfigItr config_itr = text_configs.begin(); 672 TextConfigItr config_itr = text_configs.begin();
673 TextStreamMap::iterator stream_itr = text_stream_map_.begin(); 673 TextStreamMap::iterator stream_itr = text_stream_map_.begin();
674 ChunkDemuxerStream* text_stream = stream_itr->second; 674 ChunkDemuxerStream* text_stream = stream_itr->second;
675 TextTrackConfig old_config = text_stream->text_track_config(); 675 TextTrackConfig old_config = text_stream->text_track_config();
676 TextTrackConfig new_config(config_itr->second.kind(), 676 TextTrackConfig new_config(config_itr->second.kind(),
677 config_itr->second.label(), 677 config_itr->second.label(),
678 config_itr->second.language(), 678 config_itr->second.language(),
679 old_config.id()); 679 old_config.id());
680 if (!new_config.Matches(old_config)) { 680 if (!new_config.Matches(old_config)) {
681 success &= false; 681 success &= false;
682 MEDIA_LOG(log_cb_) << "New text track config does not match old one."; 682 MEDIA_LOG(ERROR, log_cb_)
683 << "New text track config does not match old one.";
683 } else { 684 } else {
684 StreamParser::TrackId old_id = stream_itr->first; 685 StreamParser::TrackId old_id = stream_itr->first;
685 StreamParser::TrackId new_id = config_itr->first; 686 StreamParser::TrackId new_id = config_itr->first;
686 if (new_id != old_id) { 687 if (new_id != old_id) {
687 if (frame_processor_->UpdateTrack(old_id, new_id)) { 688 if (frame_processor_->UpdateTrack(old_id, new_id)) {
688 text_stream_map_.clear(); 689 text_stream_map_.clear();
689 text_stream_map_[config_itr->first] = text_stream; 690 text_stream_map_[config_itr->first] = text_stream;
690 } else { 691 } else {
691 success &= false; 692 success &= false;
692 MEDIA_LOG(log_cb_) << "Error remapping single text track number"; 693 MEDIA_LOG(ERROR, log_cb_)
694 << "Error remapping single text track number";
693 } 695 }
694 } 696 }
695 } 697 }
696 } else { 698 } else {
697 for (TextConfigItr config_itr = text_configs.begin(); 699 for (TextConfigItr config_itr = text_configs.begin();
698 config_itr != text_configs.end(); ++config_itr) { 700 config_itr != text_configs.end(); ++config_itr) {
699 TextStreamMap::iterator stream_itr = 701 TextStreamMap::iterator stream_itr =
700 text_stream_map_.find(config_itr->first); 702 text_stream_map_.find(config_itr->first);
701 if (stream_itr == text_stream_map_.end()) { 703 if (stream_itr == text_stream_map_.end()) {
702 success &= false; 704 success &= false;
703 MEDIA_LOG(log_cb_) << "Unexpected text track configuration " 705 MEDIA_LOG(ERROR, log_cb_)
704 "for track ID " 706 << "Unexpected text track configuration for track ID "
705 << config_itr->first; 707 << config_itr->first;
706 break; 708 break;
707 } 709 }
708 710
709 const TextTrackConfig& new_config = config_itr->second; 711 const TextTrackConfig& new_config = config_itr->second;
710 ChunkDemuxerStream* stream = stream_itr->second; 712 ChunkDemuxerStream* stream = stream_itr->second;
711 TextTrackConfig old_config = stream->text_track_config(); 713 TextTrackConfig old_config = stream->text_track_config();
712 if (!new_config.Matches(old_config)) { 714 if (!new_config.Matches(old_config)) {
713 success &= false; 715 success &= false;
714 MEDIA_LOG(log_cb_) << "New text track config for track ID " 716 MEDIA_LOG(ERROR, log_cb_) << "New text track config for track ID "
715 << config_itr->first 717 << config_itr->first
716 << " does not match old one."; 718 << " does not match old one.";
717 break; 719 break;
718 } 720 }
719 } 721 }
720 } 722 }
721 } 723 }
722 724
723 frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint(); 725 frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint();
724 726
725 DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed"); 727 DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed");
726 if (success) 728 if (success)
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); 1652 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN);
1651 return; 1653 return;
1652 } 1654 }
1653 1655
1654 if (params.duration != TimeDelta() && duration_ == kNoTimestamp()) 1656 if (params.duration != TimeDelta() && duration_ == kNoTimestamp())
1655 UpdateDuration(params.duration); 1657 UpdateDuration(params.duration);
1656 1658
1657 if (!params.timeline_offset.is_null()) { 1659 if (!params.timeline_offset.is_null()) {
1658 if (!timeline_offset_.is_null() && 1660 if (!timeline_offset_.is_null() &&
1659 params.timeline_offset != timeline_offset_) { 1661 params.timeline_offset != timeline_offset_) {
1660 MEDIA_LOG(log_cb_) 1662 MEDIA_LOG(ERROR, log_cb_)
1661 << "Timeline offset is not the same across all SourceBuffers."; 1663 << "Timeline offset is not the same across all SourceBuffers.";
1662 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); 1664 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN);
1663 return; 1665 return;
1664 } 1666 }
1665 1667
1666 timeline_offset_ = params.timeline_offset; 1668 timeline_offset_ = params.timeline_offset;
1667 } 1669 }
1668 1670
1669 if (params.liveness != DemuxerStream::LIVENESS_UNKNOWN) { 1671 if (params.liveness != DemuxerStream::LIVENESS_UNKNOWN) {
1670 if (liveness_ != DemuxerStream::LIVENESS_UNKNOWN && 1672 if (liveness_ != DemuxerStream::LIVENESS_UNKNOWN &&
1671 params.liveness != liveness_) { 1673 params.liveness != liveness_) {
1672 MEDIA_LOG(log_cb_) 1674 MEDIA_LOG(ERROR, log_cb_)
1673 << "Liveness is not the same across all SourceBuffers."; 1675 << "Liveness is not the same across all SourceBuffers.";
1674 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); 1676 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN);
1675 return; 1677 return;
1676 } 1678 }
1677 1679
1678 if (liveness_ != params.liveness) { 1680 if (liveness_ != params.liveness) {
1679 liveness_ = params.liveness; 1681 liveness_ = params.liveness;
1680 if (audio_) 1682 if (audio_)
1681 audio_->SetLiveness(liveness_); 1683 audio_->SetLiveness(liveness_);
1682 if (video_) 1684 if (video_)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 } 1840 }
1839 1841
1840 void ChunkDemuxer::ShutdownAllStreams() { 1842 void ChunkDemuxer::ShutdownAllStreams() {
1841 for (SourceStateMap::iterator itr = source_state_map_.begin(); 1843 for (SourceStateMap::iterator itr = source_state_map_.begin();
1842 itr != source_state_map_.end(); ++itr) { 1844 itr != source_state_map_.end(); ++itr) {
1843 itr->second->Shutdown(); 1845 itr->second->Shutdown();
1844 } 1846 }
1845 } 1847 }
1846 1848
1847 } // namespace media 1849 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698