Index: media/tools/player_wtl/movie.cc |
diff --git a/media/tools/player_wtl/movie.cc b/media/tools/player_wtl/movie.cc |
index 042d1f40f5678df938551268b00a3dc0d59c676b..2c705efebdae6a6248fefbdcecf1a6c0eb7530dc 100644 |
--- a/media/tools/player_wtl/movie.cc |
+++ b/media/tools/player_wtl/movie.cc |
@@ -84,14 +84,13 @@ bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) { |
collection->AddVideoRenderer(video_renderer); |
// Create and start our pipeline. |
- pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), NULL); |
- while (true) { |
- base::PlatformThread::Sleep(100); |
- if (pipeline_->IsInitialized()) |
- break; |
- if (pipeline_->GetError() != media::PIPELINE_OK) |
- return false; |
- } |
+ media::PipelineStatusNotification note; |
+ pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), |
+ note.Callback()); |
+ // Wait until the pipeline is fully initialized. |
+ note.Wait(); |
+ if (note.status() != PIPELINE_OK) |
+ return false; |
pipeline_->SetPlaybackRate(play_rate_); |
return true; |
} |