| 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_impl.h" | 5 #include "media/base/pipeline_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 demuxer_ = demuxer; | 79 demuxer_ = demuxer; |
| 80 renderer_ = std::move(renderer); | 80 renderer_ = std::move(renderer); |
| 81 client_weak_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 81 client_weak_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
| 82 weak_client_ = client_weak_factory_->GetWeakPtr(); | 82 weak_client_ = client_weak_factory_->GetWeakPtr(); |
| 83 seek_cb_ = media::BindToCurrentLoop(seek_cb); | 83 seek_cb_ = media::BindToCurrentLoop(seek_cb); |
| 84 media_task_runner_->PostTask( | 84 media_task_runner_->PostTask( |
| 85 FROM_HERE, base::Bind(&PipelineImpl::StartTask, weak_this_)); | 85 FROM_HERE, base::Bind(&PipelineImpl::StartTask, weak_this_)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void PipelineImpl::RestartStreamPlayback(DemuxerStream* stream, |
| 89 base::TimeDelta time) { |
| 90 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 91 DVLOG(2) << __FUNCTION__; |
| 92 media_task_runner_->PostTask( |
| 93 FROM_HERE, base::Bind(&PipelineImpl::RestartStreamPlaybackTask, |
| 94 weak_this_, stream, time)); |
| 95 } |
| 96 |
| 97 void PipelineImpl::RestartStreamPlaybackTask(DemuxerStream* stream, |
| 98 base::TimeDelta time) { |
| 99 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 100 renderer_->RestartStreamPlayback(stream, time); |
| 101 } |
| 102 |
| 88 void PipelineImpl::Stop() { | 103 void PipelineImpl::Stop() { |
| 89 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 104 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 90 DVLOG(2) << __FUNCTION__; | 105 DVLOG(2) << __FUNCTION__; |
| 91 | 106 |
| 92 if (media_task_runner_ != main_task_runner_) { | 107 if (media_task_runner_ != main_task_runner_) { |
| 93 // This path is executed by production code where the two task runners - | 108 // This path is executed by production code where the two task runners - |
| 94 // main and media - live on different threads. | 109 // main and media - live on different threads. |
| 95 // TODO(alokp): It may be possible to not have to wait for StopTask by | 110 // TODO(alokp): It may be possible to not have to wait for StopTask by |
| 96 // moving the members accessed on media thread into a class/struct and | 111 // moving the members accessed on media thread into a class/struct and |
| 97 // DeleteSoon the instance on the media thread. | 112 // DeleteSoon the instance on the media thread. |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 if (demuxer_->GetStream(DemuxerStream::AUDIO)) { | 965 if (demuxer_->GetStream(DemuxerStream::AUDIO)) { |
| 951 metadata.has_audio = true; | 966 metadata.has_audio = true; |
| 952 } | 967 } |
| 953 | 968 |
| 954 main_task_runner_->PostTask( | 969 main_task_runner_->PostTask( |
| 955 FROM_HERE, | 970 FROM_HERE, |
| 956 base::Bind(&Pipeline::Client::OnMetadata, weak_client_, metadata)); | 971 base::Bind(&Pipeline::Client::OnMetadata, weak_client_, metadata)); |
| 957 } | 972 } |
| 958 | 973 |
| 959 } // namespace media | 974 } // namespace media |
| OLD | NEW |