OLD | NEW |
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/base/pipeline.h" | 5 #include "media/base/pipeline.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 { | 684 { |
685 base::AutoLock auto_lock(lock_); | 685 base::AutoLock auto_lock(lock_); |
686 renderer_.reset(); | 686 renderer_.reset(); |
687 } | 687 } |
688 OnError(PIPELINE_ERROR_COULD_NOT_RENDER); | 688 OnError(PIPELINE_ERROR_COULD_NOT_RENDER); |
689 return; | 689 return; |
690 } | 690 } |
691 | 691 |
692 base::WeakPtr<Pipeline> weak_this = weak_factory_.GetWeakPtr(); | 692 base::WeakPtr<Pipeline> weak_this = weak_factory_.GetWeakPtr(); |
693 renderer_->Initialize( | 693 renderer_->Initialize( |
| 694 demuxer_, |
694 done_cb, | 695 done_cb, |
695 base::Bind(&Pipeline::OnUpdateStatistics, weak_this), | 696 base::Bind(&Pipeline::OnUpdateStatistics, weak_this), |
696 base::Bind(&Pipeline::OnRendererEnded, weak_this), | 697 base::Bind(&Pipeline::OnRendererEnded, weak_this), |
697 base::Bind(&Pipeline::OnError, weak_this), | 698 base::Bind(&Pipeline::OnError, weak_this), |
698 base::Bind(&Pipeline::BufferingStateChanged, weak_this)); | 699 base::Bind(&Pipeline::BufferingStateChanged, weak_this)); |
699 } | 700 } |
700 | 701 |
701 void Pipeline::ReportMetadata() { | 702 void Pipeline::ReportMetadata() { |
702 DCHECK(task_runner_->BelongsToCurrentThread()); | 703 DCHECK(task_runner_->BelongsToCurrentThread()); |
703 PipelineMetadata metadata; | 704 PipelineMetadata metadata; |
704 metadata.has_audio = renderer_->HasAudio(); | 705 metadata.has_audio = renderer_->HasAudio(); |
705 metadata.has_video = renderer_->HasVideo(); | 706 metadata.has_video = renderer_->HasVideo(); |
706 metadata.timeline_offset = demuxer_->GetTimelineOffset(); | 707 metadata.timeline_offset = demuxer_->GetTimelineOffset(); |
707 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 708 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
708 if (stream) { | 709 if (stream) { |
709 metadata.natural_size = stream->video_decoder_config().natural_size(); | 710 metadata.natural_size = stream->video_decoder_config().natural_size(); |
710 metadata.video_rotation = stream->video_rotation(); | 711 metadata.video_rotation = stream->video_rotation(); |
711 } | 712 } |
712 metadata_cb_.Run(metadata); | 713 metadata_cb_.Run(metadata); |
713 } | 714 } |
714 | 715 |
715 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { | 716 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { |
716 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; | 717 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; |
717 DCHECK(task_runner_->BelongsToCurrentThread()); | 718 DCHECK(task_runner_->BelongsToCurrentThread()); |
718 buffering_state_cb_.Run(new_buffering_state); | 719 buffering_state_cb_.Run(new_buffering_state); |
719 } | 720 } |
720 | 721 |
721 } // namespace media | 722 } // namespace media |
OLD | NEW |