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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 { | 937 { |
938 // Get an initial natural size so we have something when we signal | 938 // Get an initial natural size so we have something when we signal |
939 // the kHaveMetadata buffering state. | 939 // the kHaveMetadata buffering state. |
940 base::AutoLock l(lock_); | 940 base::AutoLock l(lock_); |
941 natural_size_ = stream->video_decoder_config().natural_size(); | 941 natural_size_ = stream->video_decoder_config().natural_size(); |
942 } | 942 } |
943 | 943 |
944 video_renderer_ = filter_collection_->GetVideoRenderer(); | 944 video_renderer_ = filter_collection_->GetVideoRenderer(); |
945 video_renderer_->Initialize( | 945 video_renderer_->Initialize( |
946 stream, | 946 stream, |
947 *filter_collection_->GetVideoDecoders(), | |
948 done_cb, | 947 done_cb, |
949 base::Bind(&Pipeline::OnUpdateStatistics, this), | 948 base::Bind(&Pipeline::OnUpdateStatistics, this), |
950 base::Bind(&Pipeline::OnVideoTimeUpdate, this), | 949 base::Bind(&Pipeline::OnVideoTimeUpdate, this), |
951 base::Bind(&Pipeline::OnNaturalVideoSizeChanged, this), | 950 base::Bind(&Pipeline::OnNaturalVideoSizeChanged, this), |
952 base::Bind(&Pipeline::OnVideoRendererEnded, this), | 951 base::Bind(&Pipeline::OnVideoRendererEnded, this), |
953 base::Bind(&Pipeline::SetError, this), | 952 base::Bind(&Pipeline::SetError, this), |
954 base::Bind(&Pipeline::GetMediaTime, this), | 953 base::Bind(&Pipeline::GetMediaTime, this), |
955 base::Bind(&Pipeline::GetMediaDuration, this)); | 954 base::Bind(&Pipeline::GetMediaDuration, this)); |
956 filter_collection_->GetVideoDecoders()->clear(); | |
957 } | 955 } |
958 | 956 |
959 void Pipeline::OnAudioUnderflow() { | 957 void Pipeline::OnAudioUnderflow() { |
960 if (!message_loop_->BelongsToCurrentThread()) { | 958 if (!message_loop_->BelongsToCurrentThread()) { |
961 message_loop_->PostTask(FROM_HERE, base::Bind( | 959 message_loop_->PostTask(FROM_HERE, base::Bind( |
962 &Pipeline::OnAudioUnderflow, this)); | 960 &Pipeline::OnAudioUnderflow, this)); |
963 return; | 961 return; |
964 } | 962 } |
965 | 963 |
966 if (state_ != kStarted) | 964 if (state_ != kStarted) |
967 return; | 965 return; |
968 | 966 |
969 if (audio_renderer_) | 967 if (audio_renderer_) |
970 audio_renderer_->ResumeAfterUnderflow(true); | 968 audio_renderer_->ResumeAfterUnderflow(true); |
971 } | 969 } |
972 | 970 |
973 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 971 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
974 lock_.AssertAcquired(); | 972 lock_.AssertAcquired(); |
975 if (!waiting_for_clock_update_) | 973 if (!waiting_for_clock_update_) |
976 return; | 974 return; |
977 | 975 |
978 waiting_for_clock_update_ = false; | 976 waiting_for_clock_update_ = false; |
979 clock_->Play(); | 977 clock_->Play(); |
980 } | 978 } |
981 | 979 |
982 } // namespace media | 980 } // namespace media |
OLD | NEW |