| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 WaitForDecodeDone(is_audio, !is_audio); | 603 WaitForDecodeDone(is_audio, !is_audio); |
| 604 | 604 |
| 605 expected_num_config_requests++; | 605 expected_num_config_requests++; |
| 606 EXPECT_EQ(expected_num_data_requests, demuxer_->num_data_requests()); | 606 EXPECT_EQ(expected_num_data_requests, demuxer_->num_data_requests()); |
| 607 EXPECT_EQ(expected_num_config_requests, demuxer_->num_config_requests()); | 607 EXPECT_EQ(expected_num_config_requests, demuxer_->num_config_requests()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void CreateNextTextureAndSetVideoSurface() { | 610 void CreateNextTextureAndSetVideoSurface() { |
| 611 gfx::SurfaceTexture* surface_texture; | 611 gfx::SurfaceTexture* surface_texture; |
| 612 if (surface_texture_a_is_next_) { | 612 if (surface_texture_a_is_next_) { |
| 613 surface_texture_a_ = new gfx::SurfaceTexture(next_texture_id_++); | 613 surface_texture_a_ = gfx::SurfaceTexture::Create(next_texture_id_++); |
| 614 surface_texture = surface_texture_a_.get(); | 614 surface_texture = surface_texture_a_.get(); |
| 615 } else { | 615 } else { |
| 616 surface_texture_b_ = new gfx::SurfaceTexture(next_texture_id_++); | 616 surface_texture_b_ = gfx::SurfaceTexture::Create(next_texture_id_++); |
| 617 surface_texture = surface_texture_b_.get(); | 617 surface_texture = surface_texture_b_.get(); |
| 618 } | 618 } |
| 619 | 619 |
| 620 surface_texture_a_is_next_ = !surface_texture_a_is_next_; | 620 surface_texture_a_is_next_ = !surface_texture_a_is_next_; |
| 621 gfx::ScopedJavaSurface surface = gfx::ScopedJavaSurface(surface_texture); | 621 gfx::ScopedJavaSurface surface = gfx::ScopedJavaSurface(surface_texture); |
| 622 player_.SetVideoSurface(surface.Pass()); | 622 player_.SetVideoSurface(surface.Pass()); |
| 623 } | 623 } |
| 624 | 624 |
| 625 // Wait for one or both of the jobs to complete decoding. Decoder jobs are | 625 // Wait for one or both of the jobs to complete decoding. Decoder jobs are |
| 626 // assumed to exist for any stream whose decode completion is awaited. | 626 // assumed to exist for any stream whose decode completion is awaited. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 // Note, the decoder job for the second surface set, above, will be created | 810 // Note, the decoder job for the second surface set, above, will be created |
| 811 // only after the pending read is satisfied and decoded, and the resulting | 811 // only after the pending read is satisfied and decoded, and the resulting |
| 812 // browser seek is done. See BrowserSeek_* tests for this coverage. | 812 // browser seek is done. See BrowserSeek_* tests for this coverage. |
| 813 } | 813 } |
| 814 | 814 |
| 815 TEST_F(MediaSourcePlayerTest, StartVideoCodecWithInvalidSurface) { | 815 TEST_F(MediaSourcePlayerTest, StartVideoCodecWithInvalidSurface) { |
| 816 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); | 816 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
| 817 | 817 |
| 818 // Test video decoder job will not be created when surface is invalid. | 818 // Test video decoder job will not be created when surface is invalid. |
| 819 scoped_refptr<gfx::SurfaceTexture> surface_texture( | 819 scoped_refptr<gfx::SurfaceTexture> surface_texture( |
| 820 new gfx::SurfaceTexture(0)); | 820 gfx::SurfaceTexture::Create(0)); |
| 821 gfx::ScopedJavaSurface surface(surface_texture.get()); | 821 gfx::ScopedJavaSurface surface(surface_texture.get()); |
| 822 StartVideoDecoderJob(false); | 822 StartVideoDecoderJob(false); |
| 823 | 823 |
| 824 // Release the surface texture. | 824 // Release the surface texture. |
| 825 surface_texture = NULL; | 825 surface_texture = NULL; |
| 826 player_.SetVideoSurface(surface.Pass()); | 826 player_.SetVideoSurface(surface.Pass()); |
| 827 | 827 |
| 828 // Player should not seek the demuxer on setting initial surface. | 828 // Player should not seek the demuxer on setting initial surface. |
| 829 EXPECT_EQ(0, demuxer_->num_seek_requests()); | 829 EXPECT_EQ(0, demuxer_->num_seek_requests()); |
| 830 | 830 |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 | 2143 |
| 2144 std::vector<std::string> codec_avc(1, "avc1"); | 2144 std::vector<std::string> codec_avc(1, "avc1"); |
| 2145 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL3, kVideoMp4, codec_avc)); | 2145 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL3, kVideoMp4, codec_avc)); |
| 2146 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL1, kVideoMp4, codec_avc)); | 2146 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL1, kVideoMp4, codec_avc)); |
| 2147 } | 2147 } |
| 2148 | 2148 |
| 2149 // TODO(xhwang): Are these IsTypeSupported tests device specific? | 2149 // TODO(xhwang): Are these IsTypeSupported tests device specific? |
| 2150 // TODO(xhwang): Add more IsTypeSupported tests. | 2150 // TODO(xhwang): Add more IsTypeSupported tests. |
| 2151 | 2151 |
| 2152 } // namespace media | 2152 } // namespace media |
| OLD | NEW |