Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: media/tools/seek_tester/seek_tester.cc

Issue 13813016: Remove reference counting from media::Demuxer and friends. (Closed) Base URL: http://git.chromium.org/chromium/src.git@vd_scoped
Patch Set: fix tools Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This standalone binary is a helper for diagnosing seek behavior of the 5 // This standalone binary is a helper for diagnosing seek behavior of the
6 // demuxer setup in media/ code. It answers the question: "if I ask the demuxer 6 // demuxer setup in media/ code. It answers the question: "if I ask the demuxer
7 // to Seek to X ms, where will it actually seek to? (necessitating 7 // to Seek to X ms, where will it actually seek to? (necessitating
8 // frame-dropping until the original seek target is reached)". Sample run: 8 // frame-dropping until the original seek target is reached)". Sample run:
9 // 9 //
10 // $ ./out/Debug/seek_tester .../LayoutTests/media/content/test.ogv 6300 10 // $ ./out/Debug/seek_tester .../LayoutTests/media/content/test.ogv 6300
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 uint64 seek_target_ms; 66 uint64 seek_target_ms;
67 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); 67 CHECK(base::StringToUint64(argv[2], &seek_target_ms));
68 scoped_refptr<media::FileDataSource> file_data_source( 68 scoped_refptr<media::FileDataSource> file_data_source(
69 new media::FileDataSource()); 69 new media::FileDataSource());
70 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1]))); 70 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1])));
71 71
72 DemuxerHostImpl host; 72 DemuxerHostImpl host;
73 MessageLoop loop; 73 MessageLoop loop;
74 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); 74 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop);
75 media::FFmpegNeedKeyCB need_key_cb = base::Bind(&NeedKey); 75 media::FFmpegNeedKeyCB need_key_cb = base::Bind(&NeedKey);
76 scoped_refptr<media::FFmpegDemuxer> demuxer( 76 scoped_ptr<media::FFmpegDemuxer> demuxer(new media::FFmpegDemuxer(
77 new media::FFmpegDemuxer(loop.message_loop_proxy(), file_data_source, 77 loop.message_loop_proxy(), file_data_source, need_key_cb));
78 need_key_cb));
79 demuxer->Initialize(&host, quitter); 78 demuxer->Initialize(&host, quitter);
80 loop.Run(); 79 loop.Run();
81 80
82 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); 81 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter);
83 loop.Run(); 82 loop.Run();
84 83
85 uint64 audio_seeked_to_ms; 84 uint64 audio_seeked_to_ms;
86 uint64 video_seeked_to_ms; 85 uint64 video_seeked_to_ms;
87 scoped_refptr<media::DemuxerStream> audio_stream( 86 scoped_refptr<media::DemuxerStream> audio_stream(
88 demuxer->GetStream(media::DemuxerStream::AUDIO)); 87 demuxer->GetStream(media::DemuxerStream::AUDIO));
(...skipping 11 matching lines...) Expand all
100 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); 99 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop));
101 loop.Run(); 100 loop.Run();
102 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; 101 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms";
103 } 102 }
104 103
105 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); 104 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop)));
106 loop.Run(); 105 loop.Run();
107 106
108 return 0; 107 return 0;
109 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698