| 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(), |
| 947 done_cb, | 948 done_cb, |
| 948 base::Bind(&Pipeline::OnUpdateStatistics, this), | 949 base::Bind(&Pipeline::OnUpdateStatistics, this), |
| 949 base::Bind(&Pipeline::OnVideoTimeUpdate, this), | 950 base::Bind(&Pipeline::OnVideoTimeUpdate, this), |
| 950 base::Bind(&Pipeline::OnNaturalVideoSizeChanged, this), | 951 base::Bind(&Pipeline::OnNaturalVideoSizeChanged, this), |
| 951 base::Bind(&Pipeline::OnVideoRendererEnded, this), | 952 base::Bind(&Pipeline::OnVideoRendererEnded, this), |
| 952 base::Bind(&Pipeline::SetError, this), | 953 base::Bind(&Pipeline::SetError, this), |
| 953 base::Bind(&Pipeline::GetMediaTime, this), | 954 base::Bind(&Pipeline::GetMediaTime, this), |
| 954 base::Bind(&Pipeline::GetMediaDuration, this)); | 955 base::Bind(&Pipeline::GetMediaDuration, this)); |
| 956 filter_collection_->GetVideoDecoders()->clear(); |
| 955 } | 957 } |
| 956 | 958 |
| 957 void Pipeline::OnAudioUnderflow() { | 959 void Pipeline::OnAudioUnderflow() { |
| 958 if (!message_loop_->BelongsToCurrentThread()) { | 960 if (!message_loop_->BelongsToCurrentThread()) { |
| 959 message_loop_->PostTask(FROM_HERE, base::Bind( | 961 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 960 &Pipeline::OnAudioUnderflow, this)); | 962 &Pipeline::OnAudioUnderflow, this)); |
| 961 return; | 963 return; |
| 962 } | 964 } |
| 963 | 965 |
| 964 if (state_ != kStarted) | 966 if (state_ != kStarted) |
| 965 return; | 967 return; |
| 966 | 968 |
| 967 if (audio_renderer_) | 969 if (audio_renderer_) |
| 968 audio_renderer_->ResumeAfterUnderflow(true); | 970 audio_renderer_->ResumeAfterUnderflow(true); |
| 969 } | 971 } |
| 970 | 972 |
| 971 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 973 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
| 972 lock_.AssertAcquired(); | 974 lock_.AssertAcquired(); |
| 973 if (!waiting_for_clock_update_) | 975 if (!waiting_for_clock_update_) |
| 974 return; | 976 return; |
| 975 | 977 |
| 976 waiting_for_clock_update_ = false; | 978 waiting_for_clock_update_ = false; |
| 977 clock_->Play(); | 979 clock_->Play(); |
| 978 } | 980 } |
| 979 | 981 |
| 980 } // namespace media | 982 } // namespace media |
| OLD | NEW |