After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746165 - first minute plays slowly (maybe half the normal speed), looks laggy
first minute plays slowly (maybe half the normal speed), looks laggy
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: general
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: General Totem maintainer(s)
General Totem maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-13 16:10 UTC by sam113101
Modified: 2015-04-24 00:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
main: Fix thumbnailing starting when launching with a video (3.13 KB, patch)
2015-04-23 15:27 UTC, Bastien Nocera
committed Details | Review
grilo: Add debug statements (902 bytes, patch)
2015-04-23 15:27 UTC, Bastien Nocera
committed Details | Review
main: Fix Videos icon not showing in volume control (917 bytes, patch)
2015-04-23 15:27 UTC, Bastien Nocera
committed Details | Review

Description sam113101 2015-03-13 16:10:52 UTC
Only happens when my computer has been running for a few days, restarting my computer temporarily fixes the problem. Doesn't happen with other players (such as VLC and MPV). Doesn't matter if the cursor is at the beginning, middle or end, the first 30~60 seconds after opening totem will be slow. I must wait for the lag go away and then everything is just as normal.
Comment 1 Bastien Nocera 2015-03-13 16:15:06 UTC
Which version of totem are you using?
Comment 2 sam113101 2015-03-13 16:27:26 UTC
(In reply to Bastien Nocera from comment #1)
> Which version of totem are you using?

3.14.2
Comment 3 Remco 2015-04-19 15:35:24 UTC
Still happens in 3.16.0 on Fedora 22. For me it happens regardless of how long my computer has been up. Some more notes:

- It happens every time I start Totem.

- It seems GNOME Shell doesn't know that Totem has started: it keeps showing that spinner in the top bar next to "Videos", as if the application is still loading.

- The lagginess stops as soon as the spinner disappears.

- When I hit the Back button in Totem and start another video, there is no new period of lagginess, which suggests that it has to do with Totem's startup.

- While lagging, the system monitor shows Totem as having 120% CPU usage and continuously increasing memory usage. When lagging stops, CPU drops to 50% and memory remains stable (though sometimes increases a bit).
Comment 4 Remco 2015-04-19 15:41:37 UTC
I also experience slowness when scrolling through the video list. It might be related. Maybe it has something to do with the thumbnails it needs to create?
Comment 5 sam113101 2015-04-19 18:30:48 UTC
I get the same thing regarding CPU usage. Starts at ~110% and drops to ~30% after 30 seconds or so.

Something interesting I've noticed (now that you mention thumbnails), is that the lag happens when I launch totem from nautilus (by clicking on a video, for example) but doesn't happen when I launch totem from the terminal. Hopefully that piece of information will help us find the problem.
Comment 6 Bastien Nocera 2015-04-22 12:32:58 UTC
All of this should have been fixed by those commits (which are in 3.14.2 and 3.16.0):

commit 38b03784eede89df510b0092d77d86eb5c837f3a
Author: Bastien Nocera <hadess@hadess.net>
Date:   Tue Nov 25 17:25:39 2014 +0100

    main: Pause thumbnailing when playback starts

commit b3785e01e7414111feec1dd245f360d2d9500ca4
Author: Bastien Nocera <hadess@hadess.net>
Date:   Tue Nov 25 17:24:06 2014 +0100

    main: Add helper to pause thumbnailing in grilo widget

commit 8bb0a36a6a09eb95464a622da589d472cda02fb8
Author: Bastien Nocera <hadess@hadess.net>
Date:   Tue Nov 25 17:05:55 2014 +0100

    main: Make it possible to pause icon thumbnailing
    
    Using g_thread_pool_set_max_threads() with 0 max threads, to freeze
    further processing until we reset the max threads count.

commit 605005d657b3df0847f9841871cdef3524b08cb5
Author: Bastien Nocera <hadess@hadess.net>
Date:   Tue Nov 25 16:42:41 2014 +0100

    main: Cancel thumbnailing on destroy
    
    Stop thumbnailing when TotemGrilo object is destroyed.

But the code to pause the thumbnailing will not stop currently processed thumbnails. So, if thumbnailing is indeed the problem:
- how do you start playing back videos? launch totem and select one of the videos in the list? or launch it directly from a file manager (which should mean that populating the videos list isn't even started)?
- how many items do you add to the playlist?
- how many items (roughly) do you have in your videos list? How many of those aren't thumbnailed yet (roughly, again)?
- are you using SSDs or spinning hard disks? (this could explain why some of the actions, which are blocking, take a long time to process, and could hog the cpu)
Comment 7 sam113101 2015-04-22 16:29:53 UTC
- how do you start playing back videos? launch totem and select one of the videos in the list? or launch it directly from a file manager (which should mean that populating the videos list isn't even started)?

I've tried multiple ways.
"totem" (in a terminal) and click on a video: laggy
"totem file.mp4" (in a terminal): not laggy
double click on a video in nautilus: laggy
double click on a video in dolphin (kde's file manager): not laggy
'gdbus call --session --dest org.gnome.Totem --object-path /org/gnome/Totem --method org.freedesktop.Application.Activate "{}"' (in a terminal): laggy

It seems that nautilus is launching totem with dbus activation, whereas dolphin is launching it normally (the equivalent of running "totem file.mp4" in a terminal). Could it be that dbus activation is somehow starting the thumbnail generation, which doesn't happen when you run "totem file.mp4"?

- how many items do you add to the playlist?
I don't use the playlist.

- how many items (roughly) do you have in your videos list? How many of those aren't thumbnailed yet (roughly, again)?
1053 total, and about half of them are not thumbnailed (at least not in totem).

- are you using SSDs or spinning hard disks? (this could explain why some of the actions, which are blocking, take a long time to process, and could hog the cpu)
I have both, the totem executable is on a SSD and the videos are on a normal HDD.
Comment 8 Bastien Nocera 2015-04-22 16:35:55 UTC
(In reply to sam113101 from comment #7)
<snip>
> I've tried multiple ways.
> "totem" (in a terminal) and click on a video: laggy
> "totem file.mp4" (in a terminal): not laggy
> double click on a video in nautilus: laggy
> double click on a video in dolphin (kde's file manager): not laggy
> 'gdbus call --session --dest org.gnome.Totem --object-path /org/gnome/Totem
> --method org.freedesktop.Application.Activate "{}"' (in a terminal): laggy
> 
> It seems that nautilus is launching totem with dbus activation, whereas
> dolphin is launching it normally (the equivalent of running "totem file.mp4"
> in a terminal). Could it be that dbus activation is somehow starting the
> thumbnail generation, which doesn't happen when you run "totem file.mp4"?

That looks like the most likely reason, yes. Will investigate that, thanks.
Comment 9 Bastien Nocera 2015-04-23 14:44:54 UTC
Before the fixes in bug 740995, launching from the command-line, would pause properly:
  • #0 totem_grilo_pause
    at totem-grilo.c line 2504
  • #1 totem_object_set_main_page
    at totem-object.c line 1027
  • #2 totem_object_app_activate
    at totem-object.c line 245
  • #6 g_application_activate
    at gapplication.c line 2111
  • #7 remote_command_cb
    at totem-menu.c line 281
  • #12 g_simple_action_activate
    at gsimpleaction.c line 225
  • #13 g_action_activate
    at gaction.c line 397
  • #14 totem_options_process_for_server
    at totem-options.c line 114
  • #15 totem_object_app_handle_local_options
    at totem-object.c line 275
  • #22 g_application_real_local_command_line
    at gapplication.c line 972
  • #23 g_application_run
    at gapplication.c line 2277
  • #24 main
    at totem.c line 83
  • #0 totem_grilo_start
    at totem-grilo.c line 2489
  • #1 totem_object_app_activate
    at totem-object.c line 241
  • #5 g_application_activate
    at gapplication.c line 2111
  • #6 totem_object_app_open
    at totem-object.c line 148
  • #13 g_application_impl_method_call
    at gapplicationimpl-dbus.c line 241
  • #19 g_application_run
    at gapplication.c line 2308
  • #20 main
    at totem.c line 83
  • #0 totem_grilo_pause
    at totem-grilo.c line 2504
  • #1 totem_object_set_main_page
    at totem-object.c line 1027
  • #2 totem_object_app_open
    at totem-object.c line 150
  • #9 g_application_impl_method_call
    at gapplicationimpl-dbus.c line 241
  • #15 g_application_run
    at gapplication.c line 2308
  • #16 main
    at totem.c line 83
  • #0 totem_grilo_start
    at totem-grilo.c line 2489
  • #1 totem_object_app_activate
    at totem-object.c line 241
  • #5 g_application_activate
    at gapplication.c line 2111
  • #6 remote_command_cb
    at totem-menu.c line 281
  • #11 g_simple_action_activate
    at gsimpleaction.c line 225
  • #12 g_action_activate
    at gaction.c line 397
  • #13 totem_options_process_for_server
    at totem-options.c line 118
  • #14 totem_object_app_handle_local_options
    at totem-object.c line 275
  • #21 g_application_real_local_command_line
    at gapplication.c line 972
  • #22 g_application_run
    at gapplication.c line 2277
  • #23 main
    at totem.c line 83
  • #0 totem_grilo_pause
    at totem-grilo.c line 2504
  • #1 totem_object_set_main_page
    at totem-object.c line 1027
  • #2 totem_object_set_mrl
    at totem-object.c line 1939

And through D-Bus, the same as without the patch.

So there's 2 problems here. One is that leaving the thumbnailers carry on working while we play the video kills performance, even though we're not actually doing that much, I've filed a separate bug about that:
https://bugzilla.gnome.org/show_bug.cgi?id=748370

The second bug is that, after recent patches, both command-line and D-Bus startups will enable the thumbnailers before turning them off. We need to fix those as well.
Comment 10 Bastien Nocera 2015-04-23 14:52:08 UTC
Bugzilla mangled my comment. See https://bugzilla.gnome.org/page.cgi?id=traceparser/trace.html&trace_id=234993 for the full thing.
Comment 11 Bastien Nocera 2015-04-23 15:26:59 UTC
Let me know if you get any assertions when running totem. Thanks for following up
on the bug, that was very helpful.

The following fixes have been pushed:
295b6d0 main: Fix thumbnailing starting when launching with a video
dd2b351 grilo: Add debug statements
Comment 12 Bastien Nocera 2015-04-23 15:27:04 UTC
Created attachment 302223 [details] [review]
main: Fix thumbnailing starting when launching with a video

We were previously relying on optionstate.filenames being non-NULL to
avoid starting thumbnailing when the user opened the player with a
video, but that actually caused doubly-adding those files passed on the
command-line, and didn't work when the Open() GApplication method was
used.

Use a separate option to keep track of whether to start populating the
grilo icon view and thumbnailing, so that thumbnailing doesn't hamper
playback performance.
Comment 13 Bastien Nocera 2015-04-23 15:27:10 UTC
Created attachment 302224 [details] [review]
grilo: Add debug statements
Comment 14 Bastien Nocera 2015-04-23 15:27:15 UTC
Created attachment 302225 [details] [review]
main: Fix Videos icon not showing in volume control

Forcefully set PulseAudio icon property. Seems that PulseAudio's client
libraries aren't quite working things out in some cases.

https://bugzilla.gnome.org/show_bug.cgi?id=745874
Comment 15 sam113101 2015-04-23 16:30:59 UTC
I don't get any assertions, but I get hundreds of error messages. For example:

totem-video-thumbnailer couldn't open file 'file:///home/sam/Videos/tV%20shows/Regular%20Show%20Season%201-4%20Complete%20+%20Specials%20(BluRay%20-%20WEB-DL)%20%5BmR12%5D/Season%202/%5B2.15%5D%20Temp%20Check.mkv'

(totem:12365): GnomeDesktop-WARNING **: Unable to create an input stream for file:///home/sam/Videos/tV%20shows/Regular%20Show%20Season%201-4%20Complete%20+%20Specials%20(BluRay%20-%20WEB-DL)%20%5BmR12%5D/Season%202/%5B2.23%5D%20A%20Bunch%20Of%20Baby%20Ducks.mkv: No such file or directory

(it goes on and on)

I renamed the "tv shows" folder a while ago, and I think that it has invalidated all of my thumbnails/videos, yet totem is still trying to load them. I think the best thing to do for totem would be to remove the videos from the list when it can't find them on the drive.
Comment 16 Bastien Nocera 2015-04-24 00:51:02 UTC
(In reply to sam113101 from comment #15)
> I don't get any assertions, but I get hundreds of error messages. For
> example:

That's not an assertion, it's an error. An assertion would stop totem altogether.

> totem-video-thumbnailer couldn't open file
> 'file:///home/sam/Videos/tV%20shows/Regular%20Show%20Season%201-
> 4%20Complete%20+%20Specials%20(BluRay%20-%20WEB-DL)%20%5BmR12%5D/Season%202/
> %5B2.15%5D%20Temp%20Check.mkv'
> 
> (totem:12365): GnomeDesktop-WARNING **: Unable to create an input stream for
> file:///home/sam/Videos/tV%20shows/Regular%20Show%20Season%201-
> 4%20Complete%20+%20Specials%20(BluRay%20-%20WEB-DL)%20%5BmR12%5D/Season%202/
> %5B2.23%5D%20A%20Bunch%20Of%20Baby%20Ducks.mkv: No such file or directory
> 
> (it goes on and on)
> 
> I renamed the "tv shows" folder a while ago, and I think that it has
> invalidated all of my thumbnails/videos, yet totem is still trying to load
> them. I think the best thing to do for totem would be to remove the videos
> from the list when it can't find them on the drive.

That's tracker not picking up the new location of the files, and isn't directly related to totem, or even grilo (the plugins of which it uses to access the Tracker database).

Best file a separate bug against Tracker about that.