Giter VIP home page Giter VIP logo

membrane-element-httpoison's People

Contributors

bblaszkow06 avatar mat-hek avatar mspanc avatar wkozyra95 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

membrane-element-httpoison's Issues

Release httpoison

  • sprawdzenie, czy one się w ogóle kompilują i działają po zmianach w core
  • sprawdzenie, czy demandy są wszędzie dodane i działają OK
  • sprawdzenie, czy callbacki są OK (np. nie ma demandów w handle_prepare)
  • poprawienie capsów tak by nie były wszędzie ustawione na any
  • przerobienie %Options{} na def_options (potrzebne do dokumentacji)
  • sformatowanie kodu w jednolity sposób (proponuję polegać na mix.format z elixira 1.6)
  • dodanie @doc, @moduledoc, @impl oraz @SPEC tam gdzie nie ma
  • dopisanie/naprawienie testów

Reconnect and Range

In the code there is a variable pos_counter, which is initialized with 0. When a new chunk is receiver, the variable is updated. If we want to resume a download on error, we just add a "Range" header.
headers = if reconnect and not is_live do [{"Range", "bytes=#{pos}-"} | headers] else headers end
The problem is that if the user already had the header then we likely to resume the download from a wrong place.

Possible solution: just initialize counter with another value if "Range" is present.

Element stops producing buffers if HTTP server is gone

It is not clear what is causing this yet, but it seems that from time to time, upon connection error, the element just stops producing buffers.

Tested on v0.2.0, httpoison 1.4.0, elixir 1.7.4, OTP 21, mac os x mojave, installed via brew.

It seems that it can be triggered by fetching MP3 stream from an icecast server and killing this server.

State of elements when that happens:

527

#{'__struct__' => 'Elixir.Membrane.Core.Element.State',
  controlling_pid => <0.523.0>,delayed_demands => #{},internal_state => nil,
  module => 'Elixir.Membrane.Element.Fake.Sink.Buffers',name => sink,
  pads =>
      #{data =>
            #{input =>
                  #{'__struct__' => 'Elixir.Membrane.Element.Pad.Data',
                    accepted_caps => any,availability => always,
                    buffer =>
                        #{'__struct__' => 'Elixir.Membrane.Core.PullBuffer',
                          current_size => 0,demand => -1,
                          demand_pid => <0.526.0>,input_ref => output,
                          metric => 'Elixir.Membrane.Buffer.Metric.Count',
                          min_demand => 2,name => sink,preferred_size => 10,
                          q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}},
                          toilet => false},
                    caps =>
                        #{'__struct__' => 'Elixir.Membrane.Caps.Audio.Raw',
                          channels => 2,format => s24le,sample_rate => 44100},
                    current_id => nil,demand => 1,demand_unit => buffers,
                    direction => input,'end_of_stream?' => true,mode => pull,
                    other_demand_unit => nil,other_ref => output,
                    pid => <0.526.0>,'start_of_stream?' => true,
                    sticky_messages => []}},
        dynamic_currently_linking => [],info => #{}},
  playback =>
      #{'__struct__' => 'Elixir.Membrane.Core.Playback',
        async_state_change => false,pending_state => nil,state => playing,
        'target_locked?' => false,target_state => playing},
  playback_buffer =>
      #{'__struct__' => 'Elixir.Membrane.Core.Element.PlaybackBuffer',
        q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}}},
  type => sink,watcher => <0.523.0>}



526

  #{'__struct__' => 'Elixir.Membrane.Core.Element.State',
  controlling_pid => <0.523.0>,delayed_demands => #{},
  internal_state =>
      #{interval => 1000000000,queue => <<>>,
        timer => {interval,#Ref<0.1549871177.3531603969.8842>}},
  module => 'Elixir.Membrane.Element.Audiometer.Peakmeter',name => meter,
  pads =>
      #{data =>
            #{input =>
                  #{'__struct__' => 'Elixir.Membrane.Element.Pad.Data',
                    accepted_caps => 'Elixir.Membrane.Caps.Audio.Raw',
                    availability => always,
                    buffer =>
                        #{'__struct__' => 'Elixir.Membrane.Core.PullBuffer',
                          current_size => 0,demand => 0,
                          demand_pid => <0.525.0>,input_ref => output,
                          metric => 'Elixir.Membrane.Buffer.Metric.Count',
                          min_demand => 2,name => meter,preferred_size => 10,
                          q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}},
                          toilet => false},
                    caps =>
                        #{'__struct__' => 'Elixir.Membrane.Caps.Audio.Raw',
                          channels => 2,format => s24le,sample_rate => 44100},
                    current_id => nil,demand => 11,demand_unit => buffers,
                    direction => input,'end_of_stream?' => true,mode => pull,
                    other_demand_unit => nil,other_ref => output,
                    pid => <0.525.0>,'start_of_stream?' => true,
                    sticky_messages => []},
              output =>
                  #{'__struct__' => 'Elixir.Membrane.Element.Pad.Data',
                    accepted_caps => 'Elixir.Membrane.Caps.Audio.Raw',
                    availability => always,buffer => nil,
                    caps =>
                        #{'__struct__' => 'Elixir.Membrane.Caps.Audio.Raw',
                          channels => 2,format => s24le,sample_rate => 44100},
                    current_id => nil,demand => 11,demand_unit => nil,
                    direction => output,'end_of_stream?' => true,mode => pull,
                    other_demand_unit => buffers,other_ref => input,
                    pid => <0.527.0>,'start_of_stream?' => false,
                    sticky_messages => nil}},
        dynamic_currently_linking => [],info => #{}},
  playback =>
      #{'__struct__' => 'Elixir.Membrane.Core.Playback',
        async_state_change => false,pending_state => nil,state => playing,
        'target_locked?' => false,target_state => playing},
  playback_buffer =>
      #{'__struct__' => 'Elixir.Membrane.Core.Element.PlaybackBuffer',
        q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}}},
  type => filter,watcher => <0.523.0>}


525

#{'__struct__' => 'Elixir.Membrane.Core.Element.State',
  controlling_pid => <0.523.0>,delayed_demands => #{},
  internal_state =>
      #{native => #Ref<0.1549871177.3531735044.2465>,
        queue =>
            <<255,251,146,100,157,142,213,77,86,199,3,108,29,208,42,32,24,112,
              0,0,0,24,157,163,44,108,155,23,72,120,0,98,4,0,0,0,171,183,174,
              221,198,158,246,236,72,168,100,79,243,187,39,157,166,179,150,
              239,247,81,169,109,252,249,114,113,209,104,108,205,232,201,174,
              67,16,139,83,84,178,200,179,146,210,155,155,92,47,152,178,145,
              245,175,59,114,152,61,213,105,79,139,79,89,141,57,201,131,229,
              127,114,237,60,49,187,18,171,188,167,152,199,178,87,73,71,90,51,
              166,254,64>>},
  module => 'Elixir.Membrane.Element.Mad.Decoder',name => decoder,
  pads =>
      #{data =>
            #{input =>
                  #{'__struct__' => 'Elixir.Membrane.Element.Pad.Data',
                    accepted_caps => [any,'Elixir.Membrane.Caps.Audio.MPEG'],
                    availability => always,
                    buffer =>
                        #{'__struct__' => 'Elixir.Membrane.Core.PullBuffer',
                          current_size => 0,demand => -1,
                          demand_pid => <0.524.0>,input_ref => output,
                          metric => 'Elixir.Membrane.Buffer.Metric.Count',
                          min_demand => 2,name => decoder,
                          preferred_size => 10,
                          q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}},
                          toilet => false},
                    caps => nil,current_id => nil,demand => 10,
                    demand_unit => buffers,direction => input,
                    'end_of_stream?' => true,mode => pull,
                    other_demand_unit => nil,other_ref => output,
                    pid => <0.524.0>,'start_of_stream?' => true,
                    sticky_messages => []},
              output =>
                  #{'__struct__' => 'Elixir.Membrane.Element.Pad.Data',
                    accepted_caps =>
                        {'Elixir.Membrane.Caps.Audio.Raw',[{format,s24le}]},
                    availability => always,buffer => nil,
                    caps =>
                        #{'__struct__' => 'Elixir.Membrane.Caps.Audio.Raw',
                          channels => 2,format => s24le,sample_rate => 44100},
                    current_id => nil,demand => 10,demand_unit => nil,
                    direction => output,'end_of_stream?' => true,mode => pull,
                    other_demand_unit => buffers,other_ref => input,
                    pid => <0.526.0>,'start_of_stream?' => false,
                    sticky_messages => nil}},
        dynamic_currently_linking => [],info => #{}},
  playback =>
      #{'__struct__' => 'Elixir.Membrane.Core.Playback',
        async_state_change => false,pending_state => nil,state => playing,
        'target_locked?' => false,target_state => playing},
  playback_buffer =>
      #{'__struct__' => 'Elixir.Membrane.Core.Element.PlaybackBuffer',
        q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}}},
  type => filter,watcher => <0.523.0>}



  524

  #{'__struct__' => 'Elixir.Membrane.Core.Element.State',
  controlling_pid => <0.523.0>,delayed_demands => #{},
  internal_state =>
      #{'__struct__' => 'Elixir.Membrane.Element.HTTPoison.Source',
        async_response => nil,body => <<>>,
        headers => [{<<"User-Agent">>,<<"MyAPp">>}],
        is_live => false,location => <<"http://localhost:8000/test.mp3">>,
        method => get,poison_opts => [],pos_counter => 196000,
        resume_on_error => false,streaming => false},
  module => 'Elixir.Membrane.Element.HTTPoison.Source',name => source,
  pads =>
      #{data =>
            #{output =>
                  #{'__struct__' => 'Elixir.Membrane.Element.Pad.Data',
                    accepted_caps => any,availability => always,buffer => nil,
                    caps => nil,current_id => nil,demand => 11,
                    demand_unit => nil,direction => output,
                    'end_of_stream?' => true,mode => pull,
                    other_demand_unit => buffers,other_ref => input,
                    pid => <0.525.0>,'start_of_stream?' => false,
                    sticky_messages => nil}},
        dynamic_currently_linking => [],info => #{}},
  playback =>
      #{'__struct__' => 'Elixir.Membrane.Core.Playback',
        async_state_change => false,pending_state => nil,state => playing,
        'target_locked?' => false,target_state => playing},
  playback_buffer =>
      #{'__struct__' => 'Elixir.Membrane.Core.Element.PlaybackBuffer',
        q => #{'__struct__' => 'Elixir.Qex',data => {[],[]}}},
  type => source,watcher => <0.523.0>}



  #{'__struct__' => 'Elixir.Membrane.Pipeline.State',
  children =>
      #{decoder => <0.525.0>,meter => <0.526.0>,sink => <0.527.0>,
        source => <0.524.0>},
  internal_state =>
      #{id => <<"5fc9e02f-0ae8-4d31-a33f-6351286f375e">>,
        slug => <<"local.ice">>,underrun_count => 263},
  module => 'Elixir.MyApp.Listener',
  pending_pids => #{'__struct__' => 'Elixir.MapSet',map => #{},version => 2},
  playback =>
      #{'__struct__' => 'Elixir.Membrane.Core.Playback',
        async_state_change => false,pending_state => nil,state => playing,
        'target_locked?' => false,target_state => playing},
  'terminating?' => false}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.