google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Decoding video stalls on movie end or frame seek #703

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Have you tried Pyglet 1.2 alpha1 or the repository code?
YES.

I tried following combinations:
Windows 8 64 bit with Python 32 bit:
2.6.6 + pyglet 1.1.4 -> bug does NOT occur
2.7.5 + pyglet 1.1.4 and "tip" as seen on 19.02.2014 -> bug OCCURS

What steps will reproduce the problem?
1. I run "media_player.py" from "examples" directory and use an example AVI 
file, without sound,
2. when I play the movie and the movie ends, the whole application window 
stalls (goes unresponsive); if I press CTRL+C at this moment, I get EXCEPTION 
#1 (see below)
3. when I play the movie and I try to seek to a video frame, the app gets 
unresponsive again and if I press CTRL+C at this moment, I get EXCEPTION #2

Paste in the traceback or error message:

EXCEPTION #1:
Traceback (most recent call last):
  File "media_player.py", line 330, in <module>
    pyglet.app.run()
  File "c:\python27\lib\site-packages\pyglet\app\__init__.py", line 143, in run
    event_loop.run()
  File "c:\python27\lib\site-packages\pyglet\app\base.py", line 136, in run
    self._run_estimated()
  File "c:\python27\lib\site-packages\pyglet\app\base.py", line 165, in _run_estimated
    timeout = self.idle()
  File "c:\python27\lib\site-packages\pyglet\app\base.py", line 274, in idle
    redraw_all = self.clock.call_scheduled_functions(dt)
  File "c:\python27\lib\site-packages\pyglet\clock.py", line 309, in call_scheduled_functions
    item.func(ts - item.last_ts, *item.args, **item.kwargs)
  File "c:\python27\lib\site-packages\pyglet\media\__init__.py", line 1140, in update_texture
    self._groups[0].get_next_video_frame() # Discard frame
  File "c:\python27\lib\site-packages\pyglet\media\__init__.py", line 814, in get_next_video_frame
    return self._sources[0].get_next_video_frame()
  File "c:\python27\lib\site-packages\pyglet\media\avbin.py", line 556, in get_next_video_frame
    self._condition.wait()
  File "c:\python27\lib\threading.py", line 339, in wait
    waiter.acquire()
KeyboardInterrupt

EXCEPTION #2: 

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "c:\python27\lib\site-packages\pyglet\window\win32\__init__.py", line 627, in _wnd_proc_view
    result = event_handler(msg, wParam, lParam)
  File "c:\python27\lib\site-packages\pyglet\window\win32\__init__.py", line 808, in _event_lbuttondown
    'on_mouse_press', mouse.LEFT, lParam)
  File "c:\python27\lib\site-packages\pyglet\window\win32\__init__.py", line 801, in _event_mousebutton
    self.dispatch_event(ev, x, y, button, self._get_modifiers())
  File "c:\python27\lib\site-packages\pyglet\window\__init__.py", line 1155, in
dispatch_event
    if EventDispatcher.dispatch_event(self, *args) != False:
  File "c:\python27\lib\site-packages\pyglet\event.py", line 365, in dispatch_event
    if getattr(self, event_type)(*args):
  File "media_player.py", line 275, in on_mouse_press
    control.on_mouse_press(x, y, button, modifiers)
  File "media_player.py", line 135, in on_mouse_press
    self.dispatch_event('on_change', value)
  File "c:\python27\lib\site-packages\pyglet\event.py", line 365, in dispatch_event
    if getattr(self, event_type)(*args):
  File "media_player.py", line 168, in <lambda>
    self.slider.on_change = lambda value: player.seek(value)
  File "c:\python27\lib\site-packages\pyglet\media\__init__.py", line 1058, in seek
    self.update_texture(time=time)
  File "c:\python27\lib\site-packages\pyglet\media\__init__.py", line 1140, in update_texture
    self._groups[0].get_next_video_frame() # Discard frame
  File "c:\python27\lib\site-packages\pyglet\media\__init__.py", line 814, in get_next_video_frame
    return self._sources[0].get_next_video_frame()
  File "c:\python27\lib\site-packages\pyglet\media\avbin.py", line 556, in get_next_video_frame
    self._condition.wait()
  File "c:\python27\lib\threading.py", line 339, in wait
    waiter.acquire()
KeyboardInterrupt

Paste in the output of `python -m pyglet.info`:
C:\Users\dotz\Desktop\pyglet-examples>python -m pyglet.info
Python
------------------------------------------------------------------------------
sys.version: 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]
sys.platform: win32
sys.maxint: 2147483647
os.getcwd(): C:\Users\dotz\Desktop\pyglet-examples

pyglet
------------------------------------------------------------------------------
pyglet.version: 1.2alpha1
pyglet.__file__: c:\python27\lib\site-packages\pyglet\__init__.pyc
pyglet.options['search_local_libs'] = True
pyglet.options['debug_win32'] = False
pyglet.options['xlib_fullscreen_override_redirect'] = False
pyglet.options['debug_trace_args'] = False
pyglet.options['font'] = ('gdiplus', 'win32')
pyglet.options['debug_gl_trace_args'] = False
pyglet.options['debug_trace'] = False
pyglet.options['debug_gl_trace'] = False
pyglet.options['debug_x11'] = False
pyglet.options['debug_media'] = False
pyglet.options['debug_trace_depth'] = 1
pyglet.options['vsync'] = None
pyglet.options['debug_gl'] = True
pyglet.options['darwin_cocoa'] = False
pyglet.options['debug_trace_flush'] = True
pyglet.options['shadow_window'] = True
pyglet.options['xsync'] = True
pyglet.options['debug_font'] = False
pyglet.options['graphics_vbo'] = True
pyglet.options['debug_lib'] = False
pyglet.options['debug_graphics_batch'] = False
pyglet.options['audio'] = ('directsound', 'pulse', 'openal', 'silent')
pyglet.options['debug_texture'] = False

pyglet.window
------------------------------------------------------------------------------
platform: <pyglet.window.Platform object at 0x0235F5B0>
display: <pyglet.canvas.win32.Win32Display object at 0x028E7710>
screens[0]: Win32Screen(x=0, y=0, width=1920, height=1080)
config['double_buffer'] = 1
config['stereo'] = 0
config['buffer_size'] = 32
config['aux_buffers'] = 0
config['sample_buffers'] = 0
config['samples'] = 0
config['red_size'] = 8
config['green_size'] = 8
config['blue_size'] = 8
config['alpha_size'] = 8
config['depth_size'] = 24
config['stencil_size'] = 8
config['accum_red_size'] = 16
config['accum_green_size'] = 16
config['accum_blue_size'] = 16
config['accum_alpha_size'] = 16
config['major_version'] = None
config['minor_version'] = None
config['forward_compatible'] = None
config['debug'] = None
context: Win32ARBContext()

window.context._info
------------------------------------------------------------------------------
gl_info.get_version(): 4.0.0 - Build 10.18.10.3379
gl_info.get_vendor(): Intel
gl_info.get_renderer(): Intel(R) HD Graphics 4000
gl_info.get_extensions():
   GL_3DFX_texture_compression_FXT1
   GL_ARB_ES2_compatibility
   GL_ARB_arrays_of_arrays
   GL_ARB_base_instance
   GL_ARB_blend_func_extended
   GL_ARB_color_buffer_float
   GL_ARB_compatibility
   GL_ARB_compressed_texture_pixel_storage
   GL_ARB_conservative_depth
   GL_ARB_copy_buffer
   GL_ARB_debug_output
   GL_ARB_depth_buffer_float
   GL_ARB_depth_clamp
   GL_ARB_depth_texture
   GL_ARB_draw_buffers
   GL_ARB_draw_buffers_blend
   GL_ARB_draw_elements_base_vertex
   GL_ARB_draw_indirect
   GL_ARB_draw_instanced
   GL_ARB_explicit_attrib_location
   GL_ARB_fragment_coord_conventions
   GL_ARB_fragment_program
   GL_ARB_fragment_program_shadow
   GL_ARB_fragment_shader
   GL_ARB_framebuffer_object
   GL_ARB_framebuffer_sRGB
   GL_ARB_geometry_shader4
   GL_ARB_get_program_binary
   GL_ARB_gpu_shader5
   GL_ARB_gpu_shader_fp64
   GL_ARB_half_float_pixel
   GL_ARB_half_float_vertex
   GL_ARB_instanced_arrays
   GL_ARB_internalformat_query
   GL_ARB_internalformat_query2
   GL_ARB_map_buffer_alignment
   GL_ARB_map_buffer_range
   GL_ARB_multi_draw_indirect
   GL_ARB_multisample
   GL_ARB_multitexture
   GL_ARB_occlusion_query
   GL_ARB_occlusion_query2
   GL_ARB_pixel_buffer_object
   GL_ARB_point_parameters
   GL_ARB_point_sprite
   GL_ARB_program_interface_query
   GL_ARB_provoking_vertex
   GL_ARB_robustness
   GL_ARB_sample_shading
   GL_ARB_sampler_objects
   GL_ARB_seamless_cube_map
   GL_ARB_separate_shader_objects
   GL_ARB_shader_atomic_counters
   GL_ARB_shader_bit_encoding
   GL_ARB_shader_objects
   GL_ARB_shader_precision
   GL_ARB_shader_subroutine
   GL_ARB_shading_language_100
   GL_ARB_shading_language_420pack
   GL_ARB_shading_language_packing
   GL_ARB_shadow
   GL_ARB_sync
   GL_ARB_tessellation_shader
   GL_ARB_texture_border_clamp
   GL_ARB_texture_buffer_object_rgb32
   GL_ARB_texture_buffer_range
   GL_ARB_texture_compression
   GL_ARB_texture_compression_bptc
   GL_ARB_texture_compression_rgtc
   GL_ARB_texture_cube_map
   GL_ARB_texture_cube_map_array
   GL_ARB_texture_env_add
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_crossbar
   GL_ARB_texture_env_dot3
   GL_ARB_texture_float
   GL_ARB_texture_gather
   GL_ARB_texture_multisample
   GL_ARB_texture_non_power_of_two
   GL_ARB_texture_query_lod
   GL_ARB_texture_rectangle
   GL_ARB_texture_rg
   GL_ARB_texture_rgb10_a2ui
   GL_ARB_texture_storage
   GL_ARB_texture_swizzle
   GL_ARB_timer_query
   GL_ARB_transform_feedback2
   GL_ARB_transform_feedback3
   GL_ARB_transform_feedback_instanced
   GL_ARB_transpose_matrix
   GL_ARB_uniform_buffer_object
   GL_ARB_vertex_array_bgra
   GL_ARB_vertex_array_object
   GL_ARB_vertex_attrib_64bit
   GL_ARB_vertex_buffer_object
   GL_ARB_vertex_program
   GL_ARB_vertex_shader
   GL_ARB_vertex_type_2_10_10_10_rev
   GL_ARB_viewport_array
   GL_ARB_window_pos
   GL_ATI_separate_stencil
   GL_EXT_abgr
   GL_EXT_bgra
   GL_EXT_blend_color
   GL_EXT_blend_equation_separate
   GL_EXT_blend_func_separate
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_clip_volume_hint
   GL_EXT_compiled_vertex_array
   GL_EXT_draw_buffers2
   GL_EXT_draw_range_elements
   GL_EXT_fog_coord
   GL_EXT_framebuffer_blit
   GL_EXT_framebuffer_multisample
   GL_EXT_framebuffer_object
   GL_EXT_geometry_shader4
   GL_EXT_gpu_program_parameters
   GL_EXT_gpu_shader4
   GL_EXT_multi_draw_arrays
   GL_EXT_packed_depth_stencil
   GL_EXT_packed_float
   GL_EXT_packed_pixels
   GL_EXT_rescale_normal
   GL_EXT_secondary_color
   GL_EXT_separate_specular_color
   GL_EXT_shadow_funcs
   GL_EXT_stencil_two_side
   GL_EXT_stencil_wrap
   GL_EXT_texture3D
   GL_EXT_texture_array
   GL_EXT_texture_compression_s3tc
   GL_EXT_texture_edge_clamp
   GL_EXT_texture_env_add
   GL_EXT_texture_env_combine
   GL_EXT_texture_filter_anisotropic
   GL_EXT_texture_integer
   GL_EXT_texture_lod_bias
   GL_EXT_texture_rectangle
   GL_EXT_texture_sRGB
   GL_EXT_texture_sRGB_decode
   GL_EXT_texture_shared_exponent
   GL_EXT_texture_snorm
   GL_EXT_texture_storage
   GL_EXT_texture_swizzle
   GL_EXT_transform_feedback
   GL_IBM_texture_mirrored_repeat
   GL_INTEL_map_texture
   GL_INTEL_performance_queries
   GL_KHR_debug
   GL_NV_blend_square
   GL_NV_conditional_render
   GL_NV_primitive_restart
   GL_NV_texgen_reflection
   GL_SGIS_generate_mipmap
   GL_SGIS_texture_edge_clamp
   GL_SGIS_texture_lod
   GL_SUN_multi_draw_arrays
   GL_WIN_swap_hint
   WGL_ARB_buffer_region
   WGL_ARB_create_context
   WGL_ARB_create_context_profile
   WGL_ARB_create_context_robustness
   WGL_ARB_extensions_string
   WGL_ARB_framebuffer_sRGB
   WGL_ARB_make_current_read
   WGL_ARB_multisample
   WGL_ARB_pbuffer
   WGL_ARB_pixel_format
   WGL_ARB_pixel_format_float
   WGL_EXT_create_context_es2_profile
   WGL_EXT_create_context_es_profile
   WGL_EXT_depth_float
   WGL_EXT_extensions_string
   WGL_EXT_pixel_format_packed_float
   WGL_EXT_swap_control
   WGL_EXT_swap_control_tear
   WGL_NV_DX_interop

pyglet.gl.glu_info
------------------------------------------------------------------------------
glu_info.get_version(): 1.2.2.0 Microsoft Corporation
glu_info.get_extensions():
   GL_EXT_bgra

pyglet.gl.glx_info
------------------------------------------------------------------------------
GLX not available.

pyglet.media
------------------------------------------------------------------------------
audio driver: <pyglet.media.drivers.directsound.DirectSoundDriver object at 
0x029BCE50>

pyglet.media.avbin
------------------------------------------------------------------------------
Library: <CDLL 'avbin', handle 6e440000 at 29b68d0>
AVbin version: 5
FFmpeg revision: 13661

pyglet.media.drivers.openal
------------------------------------------------------------------------------
OpenAL not available.

pyglet.input.wintab
------------------------------------------------------------------------------
WinTab not available.

Any additional info (platform/language/hardware) that may be relevant?

Original issue reported on code.google.com by michal....@gmail.com on 19 Feb 2014 at 11:19

GoogleCodeExporter commented 9 years ago
Possible fix (with comment) here: 
https://code.google.com/r/michaldtz-fixes-518-522/source/detail?r=9e2c43bc894c9a
108a64f10b07edc848459985f9

Original comment by michal....@gmail.com on 20 Feb 2014 at 9:53

GoogleCodeExporter commented 9 years ago
AVBin version 5? That's too old I'm afraid/

Can you try to reproduce the bug with a more recent AVBin version? Latest one 
is 10: http://avbin.github.io/AVbin/Download.html

I'm not saying that the bug is not pyglet related, but we can't support an 
AVBin version that is not supported.

Thanks for your report!

Original comment by useboxnet on 20 Feb 2014 at 5:56

GoogleCodeExporter commented 9 years ago

Original comment by useboxnet on 20 Feb 2014 at 5:56

GoogleCodeExporter commented 9 years ago
Thank you very much for your suggestion! I agree, AVbin 5 is tad old. 

So... 
I just got: fresh pyglet checkout, AVbin 10, python 2.7.6 32-bit
and I was able to reproduce the bug.

As I want to make the bugfixing experience really pleasant for you and as a 
proof of my pyglet-bugfixing journey, I also recorded an interesting 
screencast, that shows the problem. It is available on VIMEO here: 
https://vimeo.com/87213276 (the password is: pyglet). When I submitted this 
comment, website said, that I need to wait about 43 minutes for conversion of 
the video. YouTube would be faster, perhaps. Note to Google: Dear Google, I 
love YouTube and I would use it but you are not going to force me into Google 
Plus, as I value my privacy. 

As I wrote before, my commit I referenced above may be a possible fix for the 
lockup-when-movie-ends issue. I have no business in fixing video seek issue, 
but if you give me some hints, I am sure I'll be able to provide a patch. 

THANKS!

Original comment by michal....@gmail.com on 20 Feb 2014 at 8:19

GoogleCodeExporter commented 9 years ago
Thanks for the follow up!

I'll try to watch the video when it's ready.

Original comment by useboxnet on 20 Feb 2014 at 8:24

GoogleCodeExporter commented 9 years ago
Oh man, I tell you, this vid is sooo cool. Got to get my kid & my dog out of 
the room, but it was worth it! 

Original comment by michal....@gmail.com on 20 Feb 2014 at 8:29

GoogleCodeExporter commented 9 years ago
Screencast's online. http://vimeo.com/87213276, pwd: pyglet

Original comment by michal....@gmail.com on 20 Feb 2014 at 11:10