1. 02 Apr, 2019 1 commit
  2. 26 Mar, 2019 2 commits
    • Philippe Gorley's avatar
      accel: skip main memory when hardware reencoding · 52fbc755
      Philippe Gorley authored
      If the video input is being decoded on the hardware, use the hardware
      frames directly when encoding. Skips the transfer back to software in
      the video sender and the transfer to hardware in the encoder.
      Falls back to using the main memory as a middle man if the link between
      encoder and decoder fails.
      Change-Id: I59850e95e6952df71a461aad8e7dddda65f05ffb
    • Philippe Gorley's avatar
      encoder: lazy initialize video stream · dfdee183
      Philippe Gorley authored
      Sets up video streams upon receiving the first video frame. Audio
      streams are still initialized as soon as possible.
      This allows a video encoder to use the pixel format of its received
      frames, and to set up a hardware transcoding pipeline if it receives
      a hardware frame.
      Change-Id: I622fc44b6096d63d7423837d2f2ec15680548a83
  3. 06 Mar, 2019 1 commit
    • Philippe Gorley's avatar
      accel: add hardware encoding · 12932733
      Philippe Gorley authored
      Adds VAAPI and VideoToolbox hardware encoders.
      Abstracts hardware related field accesses from the encoder and decoder
      to put them in HardwareAccel. They are freed in ~HardwareAccel.
      Limits bitrate when hardware encoding h264, else it can easily go up to
      a few MiB/s.
      Change-Id: I7d847d8ab3e4c9692341f038ce6d5dd76562e606
  4. 18 Feb, 2019 1 commit
  5. 12 Feb, 2019 1 commit
    • Philippe Gorley's avatar
      encoder: cleanup and simplify · e059062a
      Philippe Gorley authored
      Cleans up the encoder a bit and removes methods that weren't used or did
      nothing. In any case, it should not be the encoder's responsibility to
      mute audio/video.
      Removes direct accesses to private data. All these options are accessible
      through the av_opt_* API with the AV_OPT_SEARCH_CHILDREN flag.
      Adding streams to the encoder is now done separately than opening an RTP
      output in an effort to streamline the encoder setup (file vs RTP).
      Change-Id: I7a868d098fa942697cfbe3246f368fb9fc7bfb0f
  6. 28 Jan, 2019 1 commit
    • Philippe Gorley's avatar
      encoder: fix recording · 53da9361
      Philippe Gorley authored
      Recorder has multiple streams, and needs to know which streams it's
      writing the packet to. Also reverts the change to a hardcoded timebase
      of 1/20.
      Change-Id: I75989ceafe4e4956ebb1adbbd53d13564aa942ea
  7. 26 Jan, 2019 1 commit
  8. 25 Jan, 2019 3 commits
    • Philippe Gorley's avatar
      encoder: allow config to override some settings · aff0eda4
      Philippe Gorley authored
      MediaEncoder sets some of AVCodecContext's fields. Allow the
      configuration file to override these fields.
      Change-Id: Ic44da217344aca2da0634e81bf247d4a21bb9510
      Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
    • Philippe Gorley's avatar
      encoder: support loading per encoder config · 19442e3b
      Philippe Gorley authored
      This allows users to use different configurations than the one provided
      by Jami. File settings overwrite Jami's existing configuration options.
      Note that only codec-level options are supported, format-level is not
      The following options are ignored, as they are set by going into the
      settings page: width, height, framerate, sample_rate, channels,
      frame_size, parameters (internal option for h264's profile level id).
      If a file encoder.json exists in the same folder as dring.yml, it is
      loaded into the encoder's configuration options. The config file is
      separated by codec. Multiple configurations can exist for the same codec
      family (ex: libx264 and h264_vaapi) because each encoder has different
      options. Section name should be the codec implementation's name and not
      the codec's name (h264 won't work, but libx264 will).
      Example configuration file:
          "libx264": {
              "crf": 15,
              "preset": "ultrafast"
          "h264_vaapi": {
              "low_power": 1
          "libopus": {
              "application": "voip"
      Change-Id: Ia6bb184af382638d4016256b393ac7295408ed82
      Gitlab: #75Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
    • Philippe Gorley's avatar
      libav_utils: add shortcut to set dictionary values · abb09e1e
      Philippe Gorley authored
      Change-Id: Iab880ac674e15dc2f0baba260632ead4cb6e4870
      Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
  9. 04 Jan, 2019 1 commit
  10. 02 Jan, 2019 1 commit
  11. 28 Dec, 2018 1 commit
    • Philippe Gorley's avatar
      encoder: make resolution even · db6c3ddf
      Philippe Gorley authored
      An even width/height is required by at least x264. This is especially
      for image and gif streaming, as video usually already has an even
      Change-Id: Ie660d8eb61dca48641cba89dd02e187481e3a127
  12. 23 Nov, 2018 1 commit
    • Jinbo Li's avatar
      encoder: add error checking to videoFrameSize · c499a22b
      Jinbo Li authored
      av_image_get_buffer_size can return a negative error code. Prevents
      casting such an error to a large positive integer that may cause a
      bad_alloc exception on the subsequent buffer allocation.
      Change-Id: Ie8a7987dcf16957a21496e791c34957bb2e35bfc
  13. 19 Nov, 2018 1 commit
  14. 08 Nov, 2018 1 commit
    • Philippe Gorley's avatar
      media: simplify timestamp computation · d36d4d6e
      Philippe Gorley authored
      Audio time bases are always the inverse of the sample rate, meaning the
      increment is always the number of samples in a frame. Video usually has
      a time base inverse of its framerate, but this is not always the case.
      Change-Id: I50d2d84d073052f8b3a832e8b99725b9d66b12a8
  15. 22 Oct, 2018 1 commit
    • Philippe Gorley's avatar
      audiobuffer: use raii when dealing with AVFrame · 222ce2c0
      Philippe Gorley authored
      Returns AudioFrame instead of raw AVFRame pointer when calling
      AudioBuffer.toAVFrame, and take AudioFrame as parameter when appending
      an AVFrame to an AudioBuffer.
      No longer need to free AVFrame during encoding/conversions.
      Change-Id: I28aa992a5483f84f6cb1a5157718c11c3a69518c
  16. 14 Sep, 2018 1 commit
  17. 11 Sep, 2018 1 commit
  18. 23 Aug, 2018 1 commit
  19. 14 Aug, 2018 1 commit
  20. 27 Jul, 2018 1 commit
    • Philippe Gorley's avatar
      audiobuffer: add conversion to AVFrame · e6ed1e1f
      Philippe Gorley authored
      Moves the AudioBuffer to AVFrame conversion logic outside of the
      MediaEncoder, so the latter only deals with AVFrame.
      Does not copy the buffer, the resulting AVFrame will simply point to the
      existing buffer.
      This is the first in a series of patches attempting to rid Ring of its
      RingBuffer/RingBufferPool system.
      Change-Id: I17c9fcdb96dc945c3eeace647303339d558bcf38
      Reviewed-by: Adrien Béraud's avatarAdrien Béraud <adrien.beraud@savoirfairelinux.com>
  21. 23 Jul, 2018 1 commit
    • Philippe Gorley's avatar
      video: replace yuv422_clear_to_black · c2bfe7cc
      Philippe Gorley authored
      FFmpeg's av_image_fill_black supports more pixel formats.
      Works around casting int* to ptrdiff_t* on platforms where ptrdiff_t
      is not the same size as int by recreating the linesize array.
      Change-Id: I2825b18c6acc921a3cd3bb1398565df0aa657153
  22. 12 Jul, 2018 1 commit
    • Philippe Gorley's avatar
      recorder: refactor pipeline · 11585ed2
      Philippe Gorley authored
      Moves the recorder up one level to the VideoInput, VideoReceiveThread
      and AudioReceiveThread, instead of the MediaDecoder (there's no
      equivalent to the VideoInput in the audio layer).
      Emits the RecordPlaybackStopped when the recording is stopped, so the
      client can sync its recording state with the daemon, in case the daemon
      stops recording by itself (rather than user intervention).
      Change-Id: I743b080cb354273ec074fec51caf2a4328fc1c58
  23. 10 Jul, 2018 2 commits
  24. 27 Jun, 2018 1 commit
    • Philippe Gorley's avatar
      media: fix timestamp woes · d6635fa4
      Philippe Gorley authored
      Stream time base is for AVPacket, while codec time base is for AVFrame.
      Good explanation found here: https://gist.github.com/yohhoy/50ea5fe868a2b3695e19
      Sets decoder framerate during stream setup.
      Scales decoder timestamps from container time base to codec time base.
      Substracts stream start time from timestamp in decoder.
      Fixes MediaStream to use AVCodecContext instead of AVStream.
      Encoders gets next timestamp using AVCodecContext instead of AVStream.
      Change-Id: I02620d825e3ff9488a4d1eb0f6eedc8dbd030df4
  25. 21 Jun, 2018 1 commit
  26. 20 Jun, 2018 1 commit
  27. 14 Jun, 2018 2 commits
  28. 06 Jun, 2018 1 commit
    • Philippe Gorley's avatar
      media: add video recording support · c21c5b77
      Philippe Gorley authored
      If there are 2 video streams, overlays local video over peer video. Peer
      video will be upscaled if it is too small, while local video will be
      scaled to 1/16th the size of the peer video.
      If there is only 1 video stream, uses peer video settings if they are
      valid, or fall back on local video settings.
      Adds title and description metadata to recorded file.
      Change-Id: I182de013e3ac2d18161eadf406fc6494e5f59a4e
  29. 05 Jun, 2018 2 commits
  30. 29 May, 2018 1 commit
  31. 16 May, 2018 1 commit
  32. 15 May, 2018 1 commit
  33. 14 May, 2018 1 commit
    • Philippe Gorley's avatar
      encoder: merge common encoding code · 43f22d20
      Philippe Gorley authored
      Refactors out the common code from video and audio encoding/flushing
      into a single method. This reuses code instead of duplicating it.
      The method is public in the hopes of being able to reuse MediaEncoder
      elsewhere in the codebase.
      Allow caller to specify the stream index for the future case that the
      AVFormatContext contains multiple streams (recording video and audio).
      Change-Id: Ieae52bc453ef66d141a40819ca10fedbd38d9a86
      Reviewed-by: Sébastien Blin's avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
  34. 24 Apr, 2018 1 commit