| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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 "webkit/glue/webmediaplayer_impl.h" | 5 #include "webkit/glue/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "media/base/media_format.h" | 9 #include "media/base/media_format.h" |
| 10 #include "media/filters/ffmpeg_audio_decoder.h" | 10 #include "media/filters/ffmpeg_audio_decoder.h" |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 break; | 530 break; |
| 531 } | 531 } |
| 532 | 532 |
| 533 // Repaint to trigger UI update. | 533 // Repaint to trigger UI update. |
| 534 Repaint(); | 534 Repaint(); |
| 535 } | 535 } |
| 536 | 536 |
| 537 void WebMediaPlayerImpl::SetNetworkState( | 537 void WebMediaPlayerImpl::SetNetworkState( |
| 538 WebKit::WebMediaPlayer::NetworkState state) { | 538 WebKit::WebMediaPlayer::NetworkState state) { |
| 539 DCHECK(MessageLoop::current() == main_loop_); | 539 DCHECK(MessageLoop::current() == main_loop_); |
| 540 if (network_state_ != state) { | 540 // Always notify to ensure client has the latest value. |
| 541 network_state_ = state; | 541 network_state_ = state; |
| 542 GetClient()->networkStateChanged(); | 542 GetClient()->networkStateChanged(); |
| 543 } | |
| 544 } | 543 } |
| 545 | 544 |
| 546 void WebMediaPlayerImpl::SetReadyState( | 545 void WebMediaPlayerImpl::SetReadyState( |
| 547 WebKit::WebMediaPlayer::ReadyState state) { | 546 WebKit::WebMediaPlayer::ReadyState state) { |
| 548 DCHECK(MessageLoop::current() == main_loop_); | 547 DCHECK(MessageLoop::current() == main_loop_); |
| 549 if (ready_state_ != state) { | 548 // Always notify to ensure client has the latest value. |
| 550 ready_state_ = state; | 549 ready_state_ = state; |
| 551 GetClient()->readyStateChanged(); | 550 GetClient()->readyStateChanged(); |
| 552 } | |
| 553 } | 551 } |
| 554 | 552 |
| 555 void WebMediaPlayerImpl::Destroy() { | 553 void WebMediaPlayerImpl::Destroy() { |
| 556 DCHECK(MessageLoop::current() == main_loop_); | 554 DCHECK(MessageLoop::current() == main_loop_); |
| 557 | 555 |
| 558 // Make sure to kill the pipeline so there's no more media threads running. | 556 // Make sure to kill the pipeline so there's no more media threads running. |
| 559 // TODO(hclam): stopping the pipeline might block for a long time. | 557 // TODO(hclam): stopping the pipeline might block for a long time. |
| 560 pipeline_->Stop(NULL); | 558 pipeline_->Stop(NULL); |
| 561 pipeline_thread_.Stop(); | 559 pipeline_thread_.Stop(); |
| 562 | 560 |
| 563 // And then detach the proxy, it may live on the render thread for a little | 561 // And then detach the proxy, it may live on the render thread for a little |
| 564 // longer until all the tasks are finished. | 562 // longer until all the tasks are finished. |
| 565 if (proxy_) { | 563 if (proxy_) { |
| 566 proxy_->Detach(); | 564 proxy_->Detach(); |
| 567 proxy_ = NULL; | 565 proxy_ = NULL; |
| 568 } | 566 } |
| 569 } | 567 } |
| 570 | 568 |
| 571 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 569 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 572 DCHECK(MessageLoop::current() == main_loop_); | 570 DCHECK(MessageLoop::current() == main_loop_); |
| 573 DCHECK(client_); | 571 DCHECK(client_); |
| 574 return client_; | 572 return client_; |
| 575 } | 573 } |
| 576 | 574 |
| 577 } // namespace webkit_glue | 575 } // namespace webkit_glue |
| OLD | NEW |