summaryrefslogtreecommitdiffstats
path: root/media/tools/player_x11/player_x11.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/tools/player_x11/player_x11.cc')
-rw-r--r--media/tools/player_x11/player_x11.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc
index 69d7fc5..73846ed 100644
--- a/media/tools/player_x11/player_x11.cc
+++ b/media/tools/player_x11/player_x11.cc
@@ -140,6 +140,7 @@ int main(int argc, char** argv) {
std::string filename =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII("file");
bool enable_audio = CommandLine::ForCurrentProcess()->HasSwitch("audio");
+ bool audio_only = false;
// Install the signal handler.
signal(SIGTERM, &TerminateHandler);
@@ -159,14 +160,20 @@ int main(int argc, char** argv) {
enable_audio, &pipeline)) {
// Main loop of the application.
g_running = true;
+
+ // Check if video is present.
+ audio_only = !pipeline->IsRendered(media::mime_type::kMajorTypeVideo);
+
while (g_running) {
if (XPending(g_display)) {
XEvent e;
XNextEvent(g_display, &e);
if (e.type == Expose) {
- // Tell the renderer to paint.
- DCHECK(Renderer::instance());
- Renderer::instance()->Paint();
+ if (!audio_only) {
+ // Tell the renderer to paint.
+ DCHECK(Renderer::instance());
+ Renderer::instance()->Paint();
+ }
} else if (e.type == ButtonPress) {
// Stop the playback.
break;